Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to save the position of TCoolBar bands in the registry Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
27-Aug-02
Category
VCL-General
Language
Delphi 4.x
Views
43
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I use a TCoolBar with several TToolbars and some other controls. During runtime a 
user can automatically reorder and resize the bands on the TCoolbar, is there a 
easy way of saving the positions and sizes of the different bands and reloading 
them a next time?

Answer:

You have to save the ID, Break, Width and Index of the bands. Following is a 
snippet of code that I use to save the Coolbar in the registry.

1   { ... }
2   
3   var
4     RegristryFile: TRegIniFile;
5   
6   const
7     Ident = 'ID';
8     Brk = 'Break';
9     Wdth = 'Width';
10    Ndx = 'Index';
11  
12    { ... }
13  
14  procedure SaveCoolBars;
15  var
16    A: Integer;
17    IdStr: string;
18  begin
19    with CoolBar, Bands do
20    begin
21      for A := 0 to Count - 1 do
22        with Bands[A] do
23        begin
24          IdStr := IntToStr(Id);
25          with RegristryFile do
26          begin
27            EraseSection(IdStr);
28            WriteBool(IdStr, Brk, Break);
29            WriteInteger(IdStr, Wdth, Width);
30            WriteInteger(IdStr, Ndx, Index);
31          end;
32        end;
33    end;
34  end;
35  
36  procedure LoadCoolBars;
37  var
38    A: Integer;
39    B: TCoolBand;
40    IdStr: string;
41  begin
42    with CoolBar, Bands do
43    begin
44      for A := 0 to Count - 1 do
45      begin
46        B := TCoolband(Bands.FindItemID(A));
47        if B = nil then
48          Continue;
49        with B, RegristryFile do
50        begin
51          IdStr := IntToStr(Id);
52          Break := ReadBool(IdStr, Brk, Break);
53          Width := ReadInteger(IdStr, Wdth, Width);
54          Index := ReadInteger(IdStr, Ndx, Index);
55        end;
56      end;
57    end;
58  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC