![]() |
#1
|
|||
|
|||
![]()
Using Toolbar, is there a way to save the settings of it (like: the number of buttons, captions of buttons, font, etc)?
Regards, Abdulaziz Jasser |
#2
|
|||
|
|||
![]()
You can save the properties in the registry, or a file of your choosing. Here's a code excerpt that I use to save the visible tool bars and position of them in a cool band. The buttons and font's are saved as part of the form, but, if you're giving your user a chance to change them, you could easily add thier properties in here.
This should give you a starting place. In my usage, I've created a class to handle my toolbars and coolbands called TToolBars. Code:
procedure TToolBars.SaveProperties; // RegKey should be like 'Software\AppName\Toolbars' // That key will have subkeys like 'Software\AppName\Toolbars\CoolBarMain' << CoolRegKey // That key will have subkeys like 'Software\AppName\Toolbars\CoolBarMain\0' <<BarRegKey // where "0" is the index of the coolbar band.values saved here. var // RegKey is global Reg: TRegistry; KeyGood: boolean; CoolRegKey, BarRegKey: string; i: integer; begin // SaveProperties Reg := TRegistry.Create; CoolRegKey := RegKey + '\Toolbars\' + CoolBar.Name; try for i := 0 to CoolBar.Bands.Count -1 do begin BarRegKey := CoolRegKey + '\' + IntToStr(i); KeyGood := Reg.OpenKey(BarRegKey, true); if KeyGood then begin Reg.WriteString('Control',CoolBar.Bands[i].Control.Name); Reg.WriteBool('Break', CoolBar.Bands[i].Break); Reg.WriteInteger('Width', CoolBar.Bands[i].Width); Reg.WriteBool('Visible', CoolBar.Bands[i].Visible); Reg.WriteInteger('Left', CoolBar.Bands[i].Control.Left); end; // if KeyGood Reg.CloseKey; end; // for i finally Reg.free; end; // try finally end; // SaveProperties jdg I love this forum. Your generosity is wonderful. |
![]() |
Thread Tools | |
Display Modes | |
|
|