Author: Tomas Rutkauskas
I can save the TToolbar positions but I never succeed in restoring their positions.
I put them in either in TControlBar or TCoolBar. How do I position them correctly?
Answer:
Saving:
1 {Coolbar}2 for i := 0 to Coolbar.Bands.Count - 1 do3 with Coolbar.Bands[i] do4 seOptions['Band' + IntToStr(ID)] := Format('%d,%d,%d,%d', [Integer(Break),
5 Width, Index, Integer(Control.Visible)]);
6 7 8 //Loading:9 10 {Coolbar}11 for i := 0 to Coolbar.Bands.Count - 1 do12 with Coolbar.Bands[i] do13 begin14 BandInfo := seOptions['Band' + IntToStr(ID)];
15 if BandInfo <> '' then16 try17 Break := Boolean(StrToInt(CutFirst(BandInfo)));
18 Width := StrToInt(CutFirst(BandInfo));
19 Index := StrToInt(CutFirst(BandInfo));
20 Control.Visible := Boolean(StrToInt(CutFirst(BandInfo))); {this line untested}21 except;
22 end;
23 end;
seOptions is a settings object and can store values 'by name'. BandInfo is a string. CutFirst returns the first value from a comma separated list string and removes it from the string.