TCoolBar is a visible component on the Common Controls tab of the Component Palette that provides a (multiline) adjustable container for other controls, usually toolbars. The controls are arranged in rows and can be adjusted in size and position.
Drop a TCoolbar on the form. It automatically aligns itself to the top of the form.
Adding controls to the coolbar
The coolbar is the container of toolbars, but any other controls can be added as well.
To add a control drop it from the component palette on the coolbar. Each dropped controls is assigned to a TCoolband instance inside the coolbar. At the left side of each coolband there is a grip which can be used to reposition the control. Alternatively, if the controls already exists outside the coolbar, drag its node in the object tree (above the object inspector) slightly below the node of the coolbar and drop it when the insertion line appears, or manually add an item to the Bands property in the object inspector and assign the control to the Control property of the band.
Set the coolbar's AutoSize to true to adjust the size of the coolbar to the size and number of the bands.
By default the band of each dropped control extends over the full width of the coolbar and occupies an individual row.
You can rearrange the controls in the coolbar by grabbing them at the grip and dragging the grip, and the control along with it, to another location. Wherever the "drag" cursor appears you can drop the control at this new location. This way you can move the controls into a single row, or conversely, drag specific controls out of such a shared row into separate rows. Note that the latter task is a bit difficult: you must drag the mouse outside to entire coolbar, but not too far so that the "do not drop" cursor appears - in this case you cannot drop the control any more even if you move the mouse back.
When the FixedSize property of the bands (and of the coolbar) is false you can also change the width of the previous band in the same way. Here a "split" cursor appear to indicate this operation. You can still move the the control to a different location, but you must grab the band at the right of the grip so that the "split" cursor disappears. This may be a bit difficult to find, and it is probably easier to turn this feature off (FixedSize = true) if your main intention is to reposition controls.
Here is a list of the most important properties:
- FixedOrder: boolean -- When this property is true it is not possible to rearrange the bands by dragging.
- FixedSize: boolean -- When this property is true is is not possible to resize the bands by dragging.
- GrabStyle: TGrabStyle = (gsSimple, gsDouble, gsHorLines, gsVerLines, gsGripper, gsButton) -- Defines the appearance of the band grip.
- GrabWidth: Integer -- This is the width, in pixels, reserved for the band grip at the left of the control in the band.
- Break: boolean -- When this is true the band begins a new row in the coolbar, otherwise the band is put in the same row as the previous band, provided that there is enough space for it. The value that you select in the object inspector is for the initial setup only. Later at runtime, Break will change when you drag controls to other locations: the first band in a row will have Break=true, all others will be switched to false.
- FixedSize: boolean -- When this is true dragging of the band grip pimarily changes the width of the previous band. It is still possible to reposition the band, but it requires some exercise to find the correct point where dragging can be initiated. When the coolbar's FixedSize is true no band can be resized no matter what its individual FixedSize setting is.
- MinHeight: Integer -- Is the minimum height of the band. Usually, however, the height of the band normally is determined by the height of the control in it. When several bands are arranged in the same row the row height is defined by the highest band.
- MinWidth: Integer -- When the control in the band is smaller than this property value the control is autosized to this width. Conversely, when the control is wider than MinWidth the band expands to the control's width.
- Visible: boolean -- Allows you to hide a band (and the associated control) by switching this property to false. When a band is hidden this way the following bands will move and fill the gap.