Coolbar Control

Hierarchy: TObject - TPersistent - TComponent - TControl - TWinControl - TToolWindow - TCoolBar

The Coolbar component allows you to create a tool bar area with bands of controls that can be moved around at run time. You can drop most types of control onto a Coolbar. You can also have a bitmap as a background for a Coolbar. Microsoft uses the Coolbar component in Internet Explorer. If you look at the menu area of IE you will see that it has a number of bands with handles which you can move around to customise the interface:

Here the bands have been moved around so that the four components are in different locations -the user can decide how wide he wants the Address Bar to be or whether to have the standard toolbar above or below the others. The user can also right-click on the standard toolbar and customise it:

To add CoolBands to a CoolBar right click the CoolBar and choose Bands Editor :

You can also get to this by clicking on the diaresis in the Bands property of the CoolBar.

To add a caption to a CoolBand select the band in the CoolBar editor or the Object Tree, select the band and change the Text property. 

Here is a form with a Coolbar, which contains five CoolBands. Two of the CoolBands have been placed next to each other along the top part of the CoolBar, the other three have been placed underneath. The two upper CoolBands contain single elements, a ComboBox and a ColorGrid respectively, while the CoolBands in the second row contain Toolbars. Each of the Toolbars contains controls of their own and has its Transparency property set to True. The Form includes a label and a RichEdit control whose properties can be changed at run-time.

These features can be seen in the Object Tree View for the form:

To change the control or toolbar that appears in a CoolBand use the Control property in the Object Inspector:

To remove borders between CoolBands set the CoolBar BandBorderStyle to bsNone.

At run-time the handles of the CoolBands can be dragged to new positions to reveal different amounts of the controls:

Also, when the user clicks on the Text for a CoolBand the band expands to full size:

To see the properties for a CoolBand select it in the CoolBand editor.

The bands inside a Coolbar can be moved around and repositioned by the user, for instance:

A TCoolBar can contain objects that do not descend from TWinControl, such as TLabel or TSpeedButton. Only TWinControl descendants, however, appear on resizable bands.

Docking

To make it possible to drag a toolbar from one container (a CoolBar or a Control Bar) just three properties need to be changed. With another CoolBar or ControlBar at the bottom of a form the key property here is Dock Site - if the container is to allow docking of floating toolbars this should be set to True. Each toolbar, if it is to be dockable, should have its DragKind property set to dkDock and its DragMode property set to dmAutomatic. It then becomes possible to drag toolbar from one container to another.

The application has been extended with a second CoolBar along the bottom of a panel and with a Status Bar beneath the panel. The Align property of the CoolBar is set to alBottom. Two new bands have been added to the CoolBar and some of the existing controls assigned to them. All toolbars and the fonts ComboBox have their drag properties set as described above so they can be moved from one CoolBar to the other or left as floating palettes above the form.

Back to Tutorial

Back to Palette List