[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomCoolBar

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Defines a Rebar-like control with resizable bands.

## Declaration

Source position: comctrls.pp line 2556

`type TCustomCoolBar = class(TToolWindow)`
`protected`
`Const`
`cDefGrabStyle = gsDouble` |  | Default value for the GrabStyle property.
`cDefGrabWidth = 10` |  | Default value for the GrabWidth property.
`cDefHorSpacing = 5` |  | Default value for the HorizontalSpacing property.
`cDefVertSpacing = 3` |  | Default value for the VerticalSpacing property.
`cNewRowBelow = cNewRowBelow; = - 1` |  | Free space below the last row.
`cNewRowAbove = cNewRowAbove; = - 2` |  | Free space above the first row.
`FBorderEdges: TEdgeBorders;` |  | Members used for the realized EdgeBorders for the control.
`FBorderLeft: SmallInt;` |  | Member used for the realized left border on the control.
`FBorderTop: SmallInt;` |  | Member used for the realized top border on the control.
`FBorderRight: SmallInt;` |  | Member used for the realized right border on the control.
`FBorderBottom: SmallInt;` |  | Member used for the realized bottom border on the control.
`FBorderWidth: SmallInt;` |  | Member used for the total width of realized borders on the control.
`FCursorBkgnd: TCursor;` |  | Member with the cursor shape when the mouse is over the cool bar background.
`FDragBand: TDragBand;` |  | Member with the band being dragged in the control.
`FDraggedBandIndex: Integer;` |  | -1 indicates the space below the last row; other negative values are an invalid area.
`FDragInitPos: Integer;` |  | Initial mouse X - position (for resizing Bands).
`FLockCursor: Boolean;` |  | Member which indicates if the cursor shape can be changed for the control.
`FRightToLeft: Boolean;` |  | Member which indicates is bands are aligned in reverse (right-to-left) order.
`FTextHeight: Integer;` |  | Member with the calculated text height used on the control.
`FVisiBands: ;` |  | Member with the visible bands for the control.
`procedure AlignControls(); override;` |  | Aligns the bands (and their controls) using the orientation, layout order, and anchors for the control.
`procedure BitmapOrImageListChange();` |  | Implements the OnChange handler used for Bitmap and Images.
`procedure CalculatePreferredSize(); override;` |  | Calculates the preferred width and height for the control.
`procedure CalculateAndAlign;` |  | Calculates the size and position for visible bands using the orientation, layout, and order for the control.
`function CalculateRealIndex();` |  | Gets the real position for the band at the specified visible position.
`procedure ChangeCursor();` |  | Changes the cursor shape when a band, a grabber, or the control background is active.
`procedure CMBiDiModeChanged(); message;` |  | Handles the CM_BIDIMODECHANGED message for the control.
`procedure CreateWnd; override;` |  | Creates the window handle for the control, and sets the cursor shape for the control background.
`procedure DoFontChanged;` |  | Calculates the text height and width in each of the bands when the font has been changed.
`procedure DrawTiledBitmap();` |  | Tile draws the specified bitmap on the control Canvas to fill the area in ARect.
`procedure FontChanged(); override;` |  | Re-implements the OnChange event handler for the Font in the control.
`function IsFirstAtRow();` |  | Checks whether the band at the specified position is the first one on a row.
`function IsRowEnd();` |  | Indicates whether the band at the specified position is the last one on a row.
`procedure MouseDown(); override;` |  | Handles mouse down messages for the control.
`procedure MouseMove(); override;` |  | Handles mouse move messages for the control.
`procedure MouseUp(); override;` |  | Handles mouse up messages for the control.
`procedure Notification(); override;` |  | Handles the notification when a component is added to or removed from the control.
`procedure Paint; override;` |  | Draws the visible bands for the control on its Canvas.
`procedure SetAlign();` |  | Sets the value for the Align property.
`procedure SetAutoSize(); override;` |  | Sets the value for the AutoSize property.
`procedure SetCursor(); override;` |  | Sets the value for the Cursor property.
`procedure WMSize(); message;` |  | Handles the LM_SIZE window message for the control.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure AutosizeBands;` |  | Indicates if a band is automatically resized to its Control.
`procedure EndUpdate; override;` |  | Ends an update process for the control.
`procedure Invalidate; override;` |  | Causes the control to be redrawn.
`procedure InsertControl(); override;` |  | Inserts a band for the specified control at the ordinal position in Index.
`procedure MouseToBandPos();` |  | Gets the position for the band under the mouse pointer.
`procedure RemoveControl(); override;` |  | Removes the band with the specified control.
`property Align: TAlign; [rw]` |  | Contains the edge in the Parent where the control is aligned.
`property BandBorderStyle: TBorderStyle; [rw]` |  | Border style used around bands on the control.
`property BandMaximize: TCoolBandMaximize; [rw]` |  | Indicates the action used to maximize the width for a band on the control.
`property Bands: TCoolBands; [rw]` |  | Collection with the bands defined for the control.
`property Bitmap: TBitmap; [rw]` |  | Optional image displayed as the background for the cool bar control.
`property FixedSize: Boolean; [rw]` |  | Indicates if bands on the control have a fixed size.
`property FixedOrder: Boolean; [rw]` |  | Indicates if the order of the bands on the control is fixed or locked.
`property GrabStyle: TGrabStyle; [rw]` |  | Drawing style used for a grabber or gripper displayed on the control.
`property GrabWidth: Integer; [rw]` |  | Width for the grabber on the control.
`property HorizontalSpacing: Integer; [rw]` |  | Horizontal space reserved between visual elements on the control.
`property Images: TCustomImageList; [rw]` |  | Contains images displayed on the bands for the control.
`property ImagesWidth: Integer; [rw]` |  | Width for the Images used in the control.
`property ShowText: Boolean; [rw]` |  | Indicates if text captions are displayed for the bands on the control.
`property Themed: Boolean; [rw]` |  | Enables or disables themed rendering for the control.
`property Vertical: Boolean; [rw]` |  | Indicates if the control is displayed vertically instead of horizontally.
`property VerticalSpacing: Integer; [rw]` |  | Vertical space reserved between visual elements in the control.
`property OnChange: TNotifyEvent; [rw]` |  | Event handler signalled when Bands are re-sized or re-ordered using the mouse.
`end;`

## Inheritance

`TCustomCoolBar` |  | Defines a Rebar-like control with resizable bands.
`TToolWindow` |  | Implements a control which can paint its client area with borders.
`TCustomControl` |  | The base class for windowed controls which paint themselves.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TCustomCoolBar is a TToolWindow descendant which defines a control like the Windows Rebar control. It provides a collection of windowed controls which are displayed in movable, resizable bands.

Each band (or TCoolBand) on the control can have a configurable sizing grip (or grabber), a bitmap, a text label, and a single windowed control. The CoolBar handles the size and position for the control when its band is moved. Each band can have a fixed size, or can automatically re-size to the contained control. Bands can be displayed one band per line, or re-sized and positioned to fill the available width or height for the CoolBar control.

A common use case is hosting multiple toolbars in an application. Separate TToolbar instance are created and configured with event handlers or actions as needed. Each toolbar is assigned as the control for a band. A perfect example is the Lazarus IDE, which uses TCoolbar to host the file, view and run toolbars in its interface.

Do not create instances of TCustomCoolBar; use the TCoolBar descendant which sets the visibility for the properties in the control.

## See also

TCoolBar |  | Implements a Rebar-like control with resizable bands.
TCoolBand |  | Implements a band displayed on the TCoolBar control.
TCoolBands |  | Implements a collection for TCoolBand items.