TFileToolbar enables the common TToolbar97 (separate available from Jordan Russel) to save and restore its buttons and separators to a ini file or the registry. Very useful, if you want the user of your program to customize the toolbars and restore this at startup.

TFileToolbar enables the common TToolbar97 (separate available from Jordan Russel) to save and restore its buttons and separators to a ini file or the registry. Very useful, if you want the user of your program to customize the toolbars and restore this at startup.

To get this to work, the loaded buttons must be attached with a TActionList (new with Delphi 4). In the ActionList are the Eventhandlers for each button. If you want display a Glyph you have to use an Imagelist, attached to the TActionList. TFileToolbar save the methode names attached to the TToolbarButtons and the names of the buttons. For example like this:

[FileToolbar1]
Caption=FileToolbar1 ToolbarButton971.G_Action=Action1 ToolbarButton972.G_Action=Action2 ToolbarButton973.G_Action=Action3 ToolbarSep971.Separator=X ToolbarButton974.G_Action=Action4 ToolbarButton975.G_Action=Action5 ToolbarButton976.G_Action=Action6 ToolbarSep972.Separator=X ToolbarButton977.G_Action=Action7 ToolbarButton978.G_Action=Action8 ToolbarButton979.G_Action=Action9
Download

Download file includes:

  • FileToolbar component
  • Full source code
  • Freeware!

Download

After loading the saved buttons, TFileToolbar looks for the TAction with the loaded name, generates a TToolbarButton97 or a TToolbarSep97 on the fly an connects it with the TAction. If there is already a button with the same name as the loaded button on the FileToolbar, it will be destroyed and replaced by the newly generated one. TFileToolbar extends the TToolbar97 with the following properties and methodes:

Properties and Methods
Actions
Holds the TActionlist, that ist conected with the buttons.
Images
Holds the TImageList, to assign the glyphes for the Buttons.
OnSave
Is called, after the contents of the Toolbar are saved to the Ini file or the registry.
OnLoad
Is called, after the contents of the Toolbar is updated from the file, an before the changes are visible on the screen.
UseRegistry
If this is true, load and save goes to the registry instead of a ini file.
StoreToolbar
Stores the current contents of the toolbar into a internal buffer.
ResetToolbar
Restores the current contents of the toolbar from the internal buffer. If the buffer is empty, nothing will happen.
LoadFromfile
Loads the contents from a ini file or the registry (look at UseRegistry property)
SaveToFile
Saves the contents of the toolbar to a ini file or the registry (look at UseRegistry property)