Sign in Join
FPDoc Onlineexperiment

TToolBar class

In unit ComCtrls

Implements an application tool bar with buttons or other visual controls.

Declaration

pascal
TToolBar = class(TToolWindow)

Inheritance

  1. TToolBar
  2. TToolWindow
  3. TCustomControl
  4. TWinControl
  5. TControl
  6. TLCLComponent
  7. TComponent
  8. TPersistent
  9. TObject

Description

TToolBar is TToolWindow descendant which implements a control used to arrange and display buttons and other controls. The buttons are used to provide direct access to features or functions in the application, much like a menu.

A tool bar is normally aligned to an edge for the parent control so that it spans its width or height. The default alignment places the tool bar along the top edge of the parent control.

In basic usage, TToolBar allows TToolButton instances with the same height and width to be added to the control. The buttons can be displayed as check boxes, drop downs (combo-boxes), or drop down buttons as well. The tool bar can be configured to display images and/or captions, as well as dividers (thin) or separators (dividers with extra spacing) between buttons.

Other visual controls can be created using the tool bar as the parent control. These controls are resized to the width or height (depending on alignment) for the tool bar.

The tool bar can be configured to wrap buttons or child controls when the controls will not fit within the dimension for the tool bar alignment. Other visual aspects can be controlled, like use of edges around the tool bar or a flat appearance.

Use the Buttons property to access and maintain the tool buttons on the control. Use Controls to access other visual control types on the tool bar.

Use the OnPaint event handler to perform custom drawing on the tool bar control when the Paint method is called. Use the OnPaintButton event handler to perform custom drawing for individual tool buttons on the control.

TToolBar is the ancestor for the TExtendedTabToolBar in the LazControls package.

See also

Properties

ButtonCountpublicNumber of Buttons defined for the tool bar control.
ButtonspublicLists with the tool buttons on the tool bar.
ButtonListpublicContains the Buttons defined for the tool bar control.
RowCountpublicNumber of rows needed to display the buttons for the control.
ButtonDropWidthpublicWidth for the drop-down button indicator.
AlignpublishedSpecifies the placement of the control inside its Parent.
AnchorspublishedThe set of anchor definitions for this control.
AutoSizepublishedAllows automatic adjustment of the size for the control, according to its content.
BorderSpacingpublishedDetermines the inner and outer border spacing for this control.
BorderWidthpublishedWidth of the Border around the control; default is zero.
ButtonHeightpublishedContains the height for buttons on the tool bar control.
ButtonWidthpublishedContains the width for buttons on the tool bar control.
CaptionpublishedThe text displayed for the control.
ChildSizingpublishedProvides a grid (table) layout for the children of this control.
ConstraintspublishedContains the minimum and maximum Width and Height for the control.
ColorpublishedThe background color for the control.
DisabledImagespublishedList with images displayed when a tool button is not enabled.
DragCursorpublishedThe cursor shape shown during a drag operation.
DragKindpublishedIndicates the action performed for a drag operation: drag-and-drop or drag-and-dock.
DragModepublishedDetermines how a drag operation is started for the control.
DropDownWidthpublishedWidth of the drop down arrow button.
EdgeBorderspublishedIndicates which edges on the tool bar are drawn with a border.
EdgeInnerpublishedSpecifies the drawing style used for the inner border of the control.
EdgeOuterpublishedSpecifies the drawing style used for the outer border of the control.
EnabledpublishedDetermines whether the control responds to mouse or keyboard input.
FlatpublishedIndicates if the control is drawn with a flat appearance.
FontpublishedThe font to be used for text display in this control.
HeightpublishedHeight for the tool bar control.
HotImagespublishedList with images displayed when a button is "hot" or hovered.
ImagespublishedList with images displayed when a tool button is enabled.
ImagesWidthpublishedWidth for the images displayed on the tool bar.
IndentpublishedNumber of pixels reserved as indentation spacing before buttons and controls on the tool bar.
ListpublishedIndicates whether buttons on the tool bar are displayed using a list style.
Menupublished
ParentColorpublishedUse the Color from the Parent control, when enabled.
ParentFontpublishedIndicates if the Font from the Parent control is used in the control.
ParentShowHintpublishedIf True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
PopupMenupublishedA context-sensitive menu that pops up when the right mouse button is clicked over this control.
ShowCaptionspublishedIndicates whether captions are displayed on tool bar buttons.
ShowHintpublishedEnables Hint display for the control.
TabOrderpublishedIndicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
TabStoppublishedAllows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.
TransparentpublishedIndicates whether the control is drawn with transparency.
VisiblepublishedAllows the control, and all of its children, to be displayed or hidden.
WrapablepublishedControls wrapping of tool buttons to the next row when they are too long for the orientation on the tool bar.
OrientationpublishedIndicates the orientation and layout direction for the buttons on the tool bar.

Methods

IsVerticalprotectedIndicates if the tool bar is oriented to display buttons and controls vertically.
WSRegisterClassprotectedRegisters the tool bar class in the widgetset.
AdjustClientRectprotectedAdjusts the client rectangle when the tool bar is drawn.
ButtonHeightIsStoredprotectedImplements the storage specifier for the ButtonHeight property.
ButtonWidthIsStoredprotectedImplements the storage specifier for the ButtonWidth property.
DropDownWidthIsStoredprotectedImplements the storage specifier for the DropDownWidth property.
GetControlClassDefaultSizeprotectedGets the default size for new instances of the class type.
DoAutoSizeprotectedDefers auto-sizing actions to the AlignControls method.
CalculatePreferredSizeprotectedCalculates the preferred size (width and height) for the control.
CheckMenuDropdownprotectedDetermines whether the specified button has a drop-down menu item which must be checked.
ClickButtonprotectedCalls the Click method for the specified tool button.
CreateWndprotectedPerforms actions needed when the Handle for the control is created.
AlignControlsprotectedPerforms actions to align the tool bar buttons in the specified rectangle.
FindButtonFromAccelprotectedGets the tool bar button with the specified accelerator key.
FontChangedprotectedPerforms actions needed when the Font has changed for the control.
LoadedprotectedPerforms actions needed when the control has finished loading from the LCL streaming mechanism.
NotificationprotectedHandles notifications for components added or removed from the control.
PaintprotectedDraws the tool bar on the Canvas for the control.
RepositionButtonprotectedRepositions the tool button at the specified position in Buttons.
RepositionButtonsprotectedRepositions the tool buttons on the tool bar.
WrapButtonsprotectedCalculates sizes and positions for buttons and controls, and handles wrapping to new rows or columns (when enabled).
CNDropDownClosedprotectedHandles the CN_DROPDOWNCLOSED control notification message.
DoAutoAdjustLayoutprotectedApplies layout changes using the specified policy and scaling proportions to the control.
CreatepublicConstructor for the class instance.
DestroypublicDestroy - destructor for TToolBar: frees buttons and links then calls inherited Destroy.
EndUpdatepublicFinishes an update process for the tool bar.
FlipChildrenpublicDisables reversing right and left alignment for child controls.
GetEnumeratorpublicGets a TToolBarEnumerator enumerator for the class instance.
SetButtonSizepublicSets the width and height for Buttons on the control to the specified values.
CanFocuspublicAlways returns False for TToolBar.

Events

OnClickpublishedNotification handler for mouse clicks.
OnContextPopuppublishedInvoked when a context-sensitive pop-up menu is requested.
OnDblClickpublishedEvent handler signalled when a mouse double click occurs in the control.
OnDragDroppublishedEvent handler signalled when an object is dropped onto the control.
OnDragOverpublishedEvent handler signalled when a control is dragged over the control instance.
OnPaintButtonpublishedEvent handler signalled to draw a button on the tool bar.
OnEndDragpublishedEvent handler signalled for the end of a drag-drop operation.
OnEnterpublishedEvent handler signalled when the control receives focus.
OnExitpublishedEvent handler signalled when the control loses focus.
OnMouseDownpublishedEvent handler signalled when a mouse down event is handled for the control.
OnMouseEnterpublishedEvent handler signalled when the mouse pointer has entered the control.
OnMouseLeavepublishedEvent handler signalled when the mouse pointer has left the control.
OnMouseMovepublishedEvent handler signalled when the mouse pointer is moved in the control.
OnMouseUppublishedEvent handler signalled when a mouse up event is handled for the control.
OnMouseWheelpublishedEvent handler for mouse wheel turned.
OnMouseWheelDownpublishedEvent handler signalled for a downward movement of the mouse wheel.
OnMouseWheelUppublishedEvent handler signalled for an upward movement of the mouse wheel.
OnPaintpublishedEvent handler signalled when the Paint method is called for the control.
OnResizepublishedNotification handler for a resize of the control.
OnChangeBoundspublishedEvent handler signalled when the Bounds for the control have been changed.
OnStartDragpublishedEvent handler signalled for the start of a dragging operation.

Fields

FPrevVerticalprotectedMember which indicates if the previous tool bar orientation was vertical.

Types and constants

cDefButtonWidthprotectedDefault width for tool buttons on the control.
cDefButtonHeightprotectedDefault height for tool buttons on the control.

Inherited

From TToolWindow (1)

BeginUpdate

From TCustomControl (6)

BorderStyle Canvas DestroyWnd PaintWindow SetColor WMPaint

From TWinControl (223)

AddControl AllAutoSized AutoAdjustLayout AutoSizeDelayed AutoSizeDelayedHandle AutoSizeDelayedReport AutoSizePhases BeginUpdateBounds BoundsLockCount BroadCast Brush BrushCreated CachedClientHeight CachedClientWidth CanSetFocus CanTab ChangeScale ChildClassAllowed ChildHandlesCreated ChildKey ClientRectNeedsInterfaceUpdate CMBiDiModeChanged CMBorderChanged CMDoubleBufferedChanged CMEnabledChanged CMEnter CMExit CMParentDoubleBufferedChanged CMShowHintChanged CMShowingChanged CMVisibleChanged CNChar CNKeyDown CNKeyUp CNSysKeyDown CNSysKeyUp ContainsControl ControlAtPos ControlCount ControlKeyDown ControlKeyUp Controls ControlsAligned CreateBrush CreateDockManager CreateHandle CreateParams CreateParented CreateParentedControl CreateSubClass CustomAlignInsertBefore CustomAlignPosition DefaultHandler DefWndProc DesignerDeleting DestroyHandle DialogChar DisableAlign DoAddDockClient DoAdjustClientRectChange DoAlignChildControls DoAllAutoSize DoChildSizingChange DockClientCount DockClients DockDrop DockManager DockOver DockSite DoConstraintsChange DoDockClientMsg DoDockOver DoDragMsg DoEnter DoExit DoFlipChildren DoFloatMsg DoGetDockCaption DoKeyDownBeforeInterface DoKeyPress DoKeyUpBeforeInterface DoRemainingKeyDown DoRemainingKeyUp DoRemoveDockClient DoSendBoundsToInterface DoSendShowHideToInterface DoSetBounds DoubleBuffered DoUnDock DoUndockClientMsg DoUTF8KeyPress EnableAlign EndUpdateBounds EraseBackground FinalizeWnd FindChildControl FindNextControl FixDesignFontsPPIWithChildren FixupTabList Focused FormEndUpdated GetAdjustedLogicalClientRect GetBorderStyle GetChildren GetChildrenRect GetClientOrigin GetClientRect GetControlIndex GetControlOrigin GetDeviceContext GetDockCaption GetEnumeratorControls GetEnumeratorControlsReverse GetMouseCapture GetParentHandle GetPreferredSizeClientFrame GetSiteInfo GetTabOrderList GetTextLen GetTopParentHandle Handle HandleAllocated HandleNeeded InitializeWnd InsertControl IntfGetDropFilesTarget IntfUTF8KeyPress Invalidate InvalidateBoundsRealized InvalidateClientRectCache InvalidatePreferredChildSizes IsClientHeightStored IsClientWidthStored IsControlMouseMsg IsFlipped IsResizing IsSpecialSubControl KeyDown KeyDownAfterInterface KeyDownBeforeInterface KeyPress KeyUp KeyUpAfterInterface KeyUpBeforeInterface LockRealizeBounds MainWndProc NotifyControls OnAlignInsertBefore OnAlignPosition OnDockDrop OnDockOver OnGetDockCaption OnGetSiteInfo OnKeyDown OnKeyPress OnKeyUp OnUnDock OnUTF8KeyPress PaintControls PaintHandler PaintTo ParentDoubleBuffered ParentFormHandleInitialized ParentHandlesAllocated ParentWindow PerformTab RealGetText ReAlign RealizeBounds RealizeBoundsRecursive RealSetText ReloadDockedControl RemoveControl RemoveFocus Repaint ScaleBy ScaleControls ScrollBy ScrollBy_WS SelectFirst SelectNext SendDialogChar SendMoveSizeMessages SetBorderStyle SetBounds SetChildZPosition SetControlIndex SetDockManager SetFocus SetShape SetTempCursor ShowControl Showing UnlockRealizeBounds Update UpdateControlState UpdateDockCaption UpdateShowing UseDockManager UTF8KeyPress VisibleDockClientCount WindowHandle WMChar WMContextMenu WMDestroy WMEnter WMEraseBkgnd WMExit WMKeyDown WMKeyUp WMKillFocus WMMove WMNotify WMSetFocus WMShowWindow WMSize WMSysChar WMSysKeyDown WMSysKeyUp WMWindowPosChanged WndProc WriteLayoutDebugReport WSSetText

From TControl (328)

AccessibleDescription AccessibleName AccessibleRole AccessibleValue Action ActionChange ActionLink ActiveDefaultControlChanged AddHandler AddHandlerOnBeforeDestruction AddHandlerOnChangeBounds AddHandlerOnEnabledChanged AddHandlerOnEnabledChanging AddHandlerOnKeyDown AddHandlerOnMouseWheel AddHandlerOnResize AddHandlerOnVisibleChanged AddHandlerOnVisibleChanging AdjustSize AnchorAsAlign AnchorClient AnchoredControlCount AnchoredControls AnchorHorizontalCenterTo AnchorParallel AnchorSame AnchorSide AnchorSideBottom AnchorSideChanged AnchorSideLeft AnchorSideRight AnchorSideTop AnchorToCompanion AnchorToNeighbour AnchorVerticalCenterTo AssignTo AutoSizing AutoSizingAll AutoSizingLockCount BaseBounds BaseParentClientSize BeforeDestruction BeforeDragStart BeginAutoDrag BeginAutoSizing BeginDrag BiDiMode BoundsChanged BoundsRect BoundsRectForNewParent BringToFront CalculateDockSizes CanAutoSize CaptureChanged CaptureMouseButtons ChangeBounds Changed CheckChildClassAllowed CheckNewParent CheckOnChangeBounds Click ClientHeight ClientOrigin ClientRect ClientToParent ClientToScreen ClientWidth CMChanged CMCursorChanged CMHintShow CMHitTest CMMouseEnter CMMouseLeave CMParentBiDiModeChanged CMParentColorChanged CMParentFontChanged CMParentShowHintChanged CMSysFontChanged CMTextChanged CNPreferredSizeChanged ColorIsStored ConstrainedResize ControlFontClass ControlOrigin ControlState ControlStyle ControlToScreen CreateAccessibleObject CreateControlBorderSpacing CreateFloatingDockSite Cursor DblClick DefineProperties DesktopFont DisableAutoSizing DoBorderSpacingChange DoCallKeyEventHandler DoCallMouseWheelEventHandler DoCallNotifyHandler Dock Docked DockOrientation DockTrackNoTarget DoContextPopup DoDock DoEndDock DoEndDrag DoFixDesignFontPPI DoMouseDown DoMouseUp DoMouseWheel DoMouseWheelDown DoMouseWheelHorz DoMouseWheelLeft DoMouseWheelRight DoMouseWheelUp DoOnChangeBounds DoOnParentHandleDestruction DoOnResize DoOnShowHint DoScaleFontPPI DoStartDock DoStartDrag DragCanceled DragDrop Dragging DragOver EditingDone EnableAutoSizing EnabledChanged EnabledChanging EndAutoSizing EndDrag ExecuteCancelAction ExecuteDefaultAction FindSubComponent FixDesignFontsPPI Floating FloatingDockSiteClass ForeignAnchorSideChanged FormIsUpdating GetAccessibleObject GetAction GetActionLinkClass GetAnchorsDependingOnParent GetCachedText GetCanvasScaleFactor GetChildAccessibleObjectAtPos GetClientScrollOffset GetColorResolvingParent GetCursor GetDefaultColor GetDefaultDockCaption GetDefaultHeight GetDefaultWidth GetDockEdge GetDragImages GetEnabled GetFloating GetFloatingDockSiteClass GetLogicalClientRect GetMousePosFromMessage GetPalette GetParentBackground GetParentComponent GetPopupMenu GetPreferredSize GetRGBColorResolvingParent GetScrolledClientRect GetSelectedChildAccessibleObject GetSidePosition GetTextBuf GetTopParent HandleObjectShouldBeVisible HasHelp HasParent HeightIsAnchored HelpContext HelpKeyword HelpType Hide Hint HostDockSite InitiateAction InvalidateControl InvalidatePreferredSize IsAParentAligning IsBorderSpacingInnerBorderStored IsCaptionStored IsControl IsControlVisible IsEnabled IsParentColor IsParentFont IsParentOf IsProcessingPaintMsg IsRightToLeft IsVisible Left LMCaptureChanged LoadedAll LRDockWidth ManualDock ManualFloat MouseCapture MouseDown MouseEnter MouseInClient MouseLeave MouseMove MouseUp OnConstrainedResize OnEditingDone OnEndDock OnMouseWheelHorz OnMouseWheelLeft OnMouseWheelRight OnQuadClick OnShowHint OnStartDock OnTripleClick Parent ParentBackground ParentBiDiMode ParentDestroyingHandle ParentFontChanged ParentToClient Perform PositionDockRect QuadClick ReadBounds ReadState Refresh RemoveAllHandlersOfObject RemoveHandler RemoveHandlerOnBeforeDestruction RemoveHandlerOnChangeBounds RemoveHandlerOnEnabledChanged RemoveHandlerOnEnabledChanging RemoveHandlerOnKeyDown RemoveHandlerOnMouseWheel RemoveHandlerOnResize RemoveHandlerOnVisibleChanged RemoveHandlerOnVisibleChanging ReplaceDockedControl RequestAlign Resize Scale96ToFont Scale96ToForm Scale96ToScreen ScaleConstraints ScaleDesignToForm ScaleFontsPPI ScaleFontTo96 ScaleFontToScreen ScaleFormTo96 ScaleFormToDesign ScaleScreenTo96 ScaleScreenToFont ScreenToClient ScreenToControl SendToBack SessionProperties SetAction SetAlign SetAnchors SetAutoSize SetBiDiMode SetBoundsKeepBase SetCursor SetDragMode SetEnabled SetHint SetInitialBounds SetName SetParent SetParentBackground SetParentBiDiMode SetParentComponent SetTextBuf SetVisible SetZOrder ShouldAutoAdjust Show ShowHelp TBDockHeight Text TextChanged Top TripleClick UndockHeight UndockWidth UpdateAnchorRules UpdateBaseBounds UpdateMouseCursor UpdateRolesForForm UseRightToLeftAlignment UseRightToLeftReading UseRightToLeftScrollBar VisibleChanged VisibleChanging Width WidthIsAnchored WindowProc WMCancelMode WMLButtonDBLCLK WMLButtonDown WMLButtonQuadCLK WMLButtonTripleCLK WMLButtonUp WMMButtonDBLCLK WMMButtonDown WMMButtonQuadCLK WMMButtonTripleCLK WMMButtonUp WMMouseHWheel WMMouseMove WMMouseWheel WMRButtonDBLCLK WMRButtonDown WMRButtonQuadCLK WMRButtonTripleCLK WMRButtonUp WMXButtonDBLCLK WMXButtonDown WMXButtonQuadCLK WMXButtonTripleCLK WMXButtonUp

From TLCLComponent (6)

DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass

From TComponent (63)

_AddRef _Release CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetDeltaStreams GetIDsOfNames GetNamePath GetObservers GetOwner GetTypeInfo GetTypeInfoCount iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (4)

Assign FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (35)

AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.