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

# TCustomControlBar

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

Implements a panel used to maintain and manage tool bars and tool buttons on a form.

## Declaration

Source position: extctrls.pp line 1571

`type TCustomControlBar = class(TCustomPanel)`
`protected`
`Const`
`cBandBorderH = cBandBorderH; = 4` |  | Space reserved for the horizontal border in a control bar.
`cBandBorderV = cBandBorderV; = 2` |  | Space reserved for the vertical border in a control bar
`cGrabWidth = cGrabWidth; = 3` |  | Space reserved as the width of the grabber in a control bar.
`cFullGrabber: SmallInt;` |  | Space needed for the width of the grabber including the control bar and its border.
`FBands: TCtrlBands;` |  | Member with the list of TCtrlBand instances for the control bar.
`FBandMove: TBandMove;` |  | Member with the band move status flag for the control bar.
`FCursorLock: Boolean;` |  | Member with the cursor lock flag set when ChangeCursor is called.
`FDefCursor: TCursor;` |  | Member with the default cursor shape for the control bar.
`FHoveredBand: TCtrlBand;` |  | Member with the band under the mouse cursor during a drag operation.
`FInitDrag: TPoint;` |  | Member with the initial coordinates for the band being dragged on the control bar.
`FInnerBevelWidth: SmallInt;` |  | Member with the width for inner bevels following a CM_BORDERCHANGED control message.
`FLockResize: Boolean;` |  | Member with a flag set to prevent resizing while the row size is updated for the control bar.
`FPrevWidth: Integer;` |  | Member with the Width for the control bar after its Handle is created.
`FVisiBands: ;` |  | Member with the visible bands for the control bar.
`FVisiBandsEx: ;` |  | Member with the visible bands on the control bar excluding a band being dragged.
`procedure AlignControlToBand();` |  | Aligns the control for the specified band and updates its coordinates for use in subsequent resize operations.
`procedure AlignControlsToBands;` |  | Aligns visible control bands in the container.
`function CalcBandHeight();` |  | Calculates the vertical space needed for a band the control bar.
`function CalcBandHeightSnapped();` |  | Calculates the vertical space needed for a band on the control bar when RowSnap is enabled.
`function CalcInnerBevelWidth;` |  | Calculates the cumulative width for all borders and bevels used on the control bar.
`function CalcLowestBandBottomPx;` |  | Gets the largest value in the Bottom property for visible bands on the control bar.
`procedure CalculatePreferredSize(); override;` |  | Calculates the preferred height and width used during auto-sizing.
`procedure ChangeCursor();` |  | Changes the cursor to the specified shape.
`procedure CheckBandsSizeAndVisibility;` |  | Updates the size and visibility for TCtrlBand instances defined in the control bar.
`procedure CMBiDiModeChanged(); message;` |  | Handles the CM_BIDIMODECHANGED message.
`procedure CMBorderChanged(); message;` |  | Handles the CM_BORDERCHANGED message.
`procedure CreateWnd; override;` |  | Ensures the default values taken from Cursor and Width are assigned when the window handle is created.
`procedure DoBandMove(); virtual;` |  | Signals the OnBandMove event handler for the specified control and drawing rectangle.
`procedure DoBandPaint(); virtual;` |  | Signals the OnBandPaint event handler using the specified arguments.
`function DragControl(); virtual;` |  | Signals an assigned OnBandDrag event handler and starts a drag operation for the specified control.
`procedure DragOver(); override;` |  | Called when an object is dragged over this control; Determines whether a drop is acceptable, using the OnDragOver handler.
`procedure GetControlInfo(); virtual;` |  | Signals the OnBandInfo event handler to store control information to the arguments for the method.
`class constructor InitializeClass;` |  | Class constructor which initializes class constants.
`procedure InitializeBand();` |  | Configures a control bar band and calculates its row position, order, and geometry including client decorations.
`procedure InitializeMove();` |  | Prepares visible bands on the control bar for a drag and drop operation.
`procedure Loaded; override;` |  | Performs actions needed when component loading has been completed.
`function IsBandOverlap();` |  | Determines if the display rectangles for two bands overlap.
`procedure MouseDown(); override;` |  | Handles a mouse down message in the control.
`procedure MouseMove(); override;` |  | Handles a mouse move message including dragging a control band.
`procedure MouseUp(); override;` |  | Handles a mouse up message that ends a drag operation for a control band.
`procedure MoveBand();` |  | Performs actions needed when a band is moved to new position.
`procedure NormalizeRows;` |  | Orders visible bands on the control by their coordinates, and hides empty rows.
`procedure Paint; override;` |  | Draws the control with its image, decorations, and visible bands.
`procedure PictureChanged();` |  | Redraws the image on the control bar when the Picture property has been changed.
`procedure Resize; override;` |  | Signals the OnResize event handler (when assigned) and re-aligns bands and their controls.
`procedure SetCursor(); override;` |  | Sets the Cursor to the specified TCursor shape.
`procedure ShiftBands();` |  | Shifts the positions for a range of bands by the specified amount.
`procedure SortVisibleBands;` |  | Calculates the number of visible bands (and controls) and optionally sorts visible bands to reflect their Top and Left coordinates.
`procedure WMSize(); message;` |  | Handles the LM_SIZE message for the control.
`public`
`FUpdateCount: SmallInt;` |  | Member with the update counter for the control bar.
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure BeginUpdate;` |  | Increments the internal counter used to track the number of active update requests.
`procedure EndUpdate;` |  | Decrements the internal counter used to track update requests, and calls Invalidate when the counter reaches zero (0).
`procedure FlipChildren(); override;` |  | Flips the horizontal display coordiantes for child controls.
`function HitTest();` |  | Gets the control for the visible band under the specified mouse coordinates.
`procedure InsertControl(); override;` |  | Creates and stores a new band for the specified control.
`function MouseToBandPos();` |  | Gets the visible band on the control bar at the specified mouse coordinates.
`procedure RemoveControl(); override;` |  | Removes the band with the specified control.
`procedure StickControls; virtual;` |  | Aligns controls to both their bands and the control bar.
`property AutoDock: Boolean; [rw]` |  | Not used in the current LCL implementation.
`property AutoDrag: Boolean; [rw]` |  | Indicates if the control allows a band to be dragged even when DragManager is not used.
`property AutoSize: Boolean;` |  | Indicates if bands are automatically sized and positioned on the control bar.
`property DockSite: Boolean;` |  | Allows drag-docking of controls onto this control.
`property DrawingStyle: TBandDrawingStyle; [rw]` |  | Fill style used for bands on the control bar.
`property GradientDirection: TGradientDirection; [rw]` |  | Controls the direction for a gradient drawn on the control bar.
`property GradientStartColor: TColor; [rw]` |  | Specifies the initial color used in a gradient drawn on the control bar.
`property GradientEndColor: TColor; [rw]` |  | Specifies the ending color used in a gradient drawn on the control bar.
`property Picture: TPicture; [rw]` |  | Optional image drawn before the visible bands for the control bar.
`property RowSize: TRowSize; [rw]` |  | Height used for a band or a row of bands displayed on the control bar.
`property RowSnap: Boolean; [rw]` |  | Indicates if a band or row of bands snaps to the height for the control bar.
`property OnBandDrag: TBandDragEvent; [rw]` |  | Event handler signalled when a drag operation is about to begin for a band on the control bar.
`property OnBandInfo: TBandInfoEvent; [rw]` |  | Event handler signalled to get the insets rectangles, preferred size, and row count for the control bar.
`property OnBandMove: TBandMoveEvent; [rw]` |  | Event handler signalled when a control band is moved on the control bar.
`property OnBandPaint: TBandPaintEvent; [rw]` |  | Event handler signalled to render a visible band on the specified control with the specified paint options.
`property OnCanResize: TCanResizeEvent; [rw]` |  | Not used in the current implementation of TCustomControlBar / TControlBar.
`property OnPaint: TNotifyEvent; [rw]` |  | Event handler signalled to perform default drawing in the inherited Paint method.
`end;`

## Inheritance

`TCustomControlBar` |  | Implements a panel used to maintain and manage tool bars and tool buttons on a form.
`TCustomPanel` |  | The base class for a general container which can hold other objects. It has a customizable border and a central text.
`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

TCustomControlBar is a TCustomPanel descendant used to maintain and manage tool bars and tool buttons added to the container.

Internally, it uses a TCtrlBands member to represent the TToolBar, TToolButton, or TCoolBar classes added to the container. Use InsertControl and RemoveControl to maintain items in the container at run-time, or use the design-time support provided in the Lazarus Form Designer.

## See also

TCustomPanel |  | The base class for a general container which can hold other objects. It has a customizable border and a central text.
TCtrlBands |  | Container used to store TCtrlBand instances.
TToolBar |  | Implements an application tool bar with buttons or other visual controls.
TCoolBar |  | Implements a Rebar-like control with resizable bands.
TToolButton |  | TToolButton is a button control used in a TToolBar object.