TToolBar class
Implements an application tool bar with buttons or other visual controls.
Declaration
TToolBar = class(TToolWindow)Inheritance
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
ButtonCount | public | Number of Buttons defined for the tool bar control. |
Buttons | public | Lists with the tool buttons on the tool bar. |
ButtonList | public | Contains the Buttons defined for the tool bar control. |
RowCount | public | Number of rows needed to display the buttons for the control. |
ButtonDropWidth | public | Width for the drop-down button indicator. |
Align | published | Specifies the placement of the control inside its Parent. |
Anchors | published | The set of anchor definitions for this control. |
AutoSize | published | Allows automatic adjustment of the size for the control, according to its content. |
BorderSpacing | published | Determines the inner and outer border spacing for this control. |
BorderWidth | published | Width of the Border around the control; default is zero. |
ButtonHeight | published | Contains the height for buttons on the tool bar control. |
ButtonWidth | published | Contains the width for buttons on the tool bar control. |
Caption | published | The text displayed for the control. |
ChildSizing | published | Provides a grid (table) layout for the children of this control. |
Constraints | published | Contains the minimum and maximum Width and Height for the control. |
Color | published | The background color for the control. |
DisabledImages | published | List with images displayed when a tool button is not enabled. |
DragCursor | published | The cursor shape shown during a drag operation. |
DragKind | published | Indicates the action performed for a drag operation: drag-and-drop or drag-and-dock. |
DragMode | published | Determines how a drag operation is started for the control. |
DropDownWidth | published | Width of the drop down arrow button. |
EdgeBorders | published | Indicates which edges on the tool bar are drawn with a border. |
EdgeInner | published | Specifies the drawing style used for the inner border of the control. |
EdgeOuter | published | Specifies the drawing style used for the outer border of the control. |
Enabled | published | Determines whether the control responds to mouse or keyboard input. |
Flat | published | Indicates if the control is drawn with a flat appearance. |
Font | published | The font to be used for text display in this control. |
Height | published | Height for the tool bar control. |
HotImages | published | List with images displayed when a button is "hot" or hovered. |
Images | published | List with images displayed when a tool button is enabled. |
ImagesWidth | published | Width for the images displayed on the tool bar. |
Indent | published | Number of pixels reserved as indentation spacing before buttons and controls on the tool bar. |
List | published | Indicates whether buttons on the tool bar are displayed using a list style. |
Menu | published | |
ParentColor | published | Use the Color from the Parent control, when enabled. |
ParentFont | published | Indicates if the Font from the Parent control is used in the control. |
ParentShowHint | published | If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True. |
PopupMenu | published | A context-sensitive menu that pops up when the right mouse button is clicked over this control. |
ShowCaptions | published | Indicates whether captions are displayed on tool bar buttons. |
ShowHint | published | Enables Hint display for the control. |
TabOrder | published | Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key. |
TabStop | published | Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys. |
Transparent | published | Indicates whether the control is drawn with transparency. |
Visible | published | Allows the control, and all of its children, to be displayed or hidden. |
Wrapable | published | Controls wrapping of tool buttons to the next row when they are too long for the orientation on the tool bar. |
Orientation | published | Indicates the orientation and layout direction for the buttons on the tool bar. |
Methods
IsVertical | protected | Indicates if the tool bar is oriented to display buttons and controls vertically. |
WSRegisterClass | protected | Registers the tool bar class in the widgetset. |
AdjustClientRect | protected | Adjusts the client rectangle when the tool bar is drawn. |
ButtonHeightIsStored | protected | Implements the storage specifier for the ButtonHeight property. |
ButtonWidthIsStored | protected | Implements the storage specifier for the ButtonWidth property. |
DropDownWidthIsStored | protected | Implements the storage specifier for the DropDownWidth property. |
GetControlClassDefaultSize | protected | Gets the default size for new instances of the class type. |
DoAutoSize | protected | Defers auto-sizing actions to the AlignControls method. |
CalculatePreferredSize | protected | Calculates the preferred size (width and height) for the control. |
CheckMenuDropdown | protected | Determines whether the specified button has a drop-down menu item which must be checked. |
ClickButton | protected | Calls the Click method for the specified tool button. |
CreateWnd | protected | Performs actions needed when the Handle for the control is created. |
AlignControls | protected | Performs actions to align the tool bar buttons in the specified rectangle. |
FindButtonFromAccel | protected | Gets the tool bar button with the specified accelerator key. |
FontChanged | protected | Performs actions needed when the Font has changed for the control. |
Loaded | protected | Performs actions needed when the control has finished loading from the LCL streaming mechanism. |
Notification | protected | Handles notifications for components added or removed from the control. |
Paint | protected | Draws the tool bar on the Canvas for the control. |
RepositionButton | protected | Repositions the tool button at the specified position in Buttons. |
RepositionButtons | protected | Repositions the tool buttons on the tool bar. |
WrapButtons | protected | Calculates sizes and positions for buttons and controls, and handles wrapping to new rows or columns (when enabled). |
CNDropDownClosed | protected | Handles the CN_DROPDOWNCLOSED control notification message. |
DoAutoAdjustLayout | protected | Applies layout changes using the specified policy and scaling proportions to the control. |
Create | public | Constructor for the class instance. |
Destroy | public | Destroy - destructor for TToolBar: frees buttons and links then calls inherited Destroy. |
EndUpdate | public | Finishes an update process for the tool bar. |
FlipChildren | public | Disables reversing right and left alignment for child controls. |
GetEnumerator | public | Gets a TToolBarEnumerator enumerator for the class instance. |
SetButtonSize | public | Sets the width and height for Buttons on the control to the specified values. |
CanFocus | public | Always returns False for TToolBar. |
Events
OnClick | published | Notification handler for mouse clicks. |
OnContextPopup | published | Invoked when a context-sensitive pop-up menu is requested. |
OnDblClick | published | Event handler signalled when a mouse double click occurs in the control. |
OnDragDrop | published | Event handler signalled when an object is dropped onto the control. |
OnDragOver | published | Event handler signalled when a control is dragged over the control instance. |
OnPaintButton | published | Event handler signalled to draw a button on the tool bar. |
OnEndDrag | published | Event handler signalled for the end of a drag-drop operation. |
OnEnter | published | Event handler signalled when the control receives focus. |
OnExit | published | Event handler signalled when the control loses focus. |
OnMouseDown | published | Event handler signalled when a mouse down event is handled for the control. |
OnMouseEnter | published | Event handler signalled when the mouse pointer has entered the control. |
OnMouseLeave | published | Event handler signalled when the mouse pointer has left the control. |
OnMouseMove | published | Event handler signalled when the mouse pointer is moved in the control. |
OnMouseUp | published | Event handler signalled when a mouse up event is handled for the control. |
OnMouseWheel | published | Event handler for mouse wheel turned. |
OnMouseWheelDown | published | Event handler signalled for a downward movement of the mouse wheel. |
OnMouseWheelUp | published | Event handler signalled for an upward movement of the mouse wheel. |
OnPaint | published | Event handler signalled when the Paint method is called for the control. |
OnResize | published | Notification handler for a resize of the control. |
OnChangeBounds | published | Event handler signalled when the Bounds for the control have been changed. |
OnStartDrag | published | Event handler signalled for the start of a dragging operation. |
Fields
FPrevVertical | protected | Member which indicates if the previous tool bar orientation was vertical. |
Types and constants
cDefButtonWidth | protected | Default width for tool buttons on the control. |
cDefButtonHeight | protected | Default height for tool buttons on the control. |
Inherited
From TToolWindow (1)
From TCustomControl (6)
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.
