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

TToolBar

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

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

Declaration

Source position: comctrls.pp line 2244

type TToolBar = class(TToolWindow)

protected

Const

  cDefButtonWidth = 23

  

Default width for tool buttons on the control.

  cDefButtonHeight = 22

  

Default height for tool buttons on the control.

  FPrevVertical: Boolean;

  

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

  function IsVertical; virtual;

  

Indicates if the tool bar is oriented to display buttons and controls vertically.

  class procedure WSRegisterClass; override;

  

Registers the tool bar class in the widgetset.

  procedure AdjustClientRect(); override;

  

Adjusts the client rectangle when the tool bar is drawn.

  function ButtonHeightIsStored;

  

Implements the storage specifier for the ButtonHeight property.

  function ButtonWidthIsStored;

  

Implements the storage specifier for the ButtonWidth property.

  function DropDownWidthIsStored;

  

Implements the storage specifier for the DropDownWidth property.

  class function GetControlClassDefaultSize; override;

  

Gets the default size for new instances of the class type.

  procedure DoAutoSize; override;

  

Defers auto-sizing actions to the AlignControls method.

  procedure CalculatePreferredSize(); override;

  

Override this method to return the preferred height and width for the control.

  function CheckMenuDropdown(); virtual;

  

Determines whether the specified button has a drop-down menu item which must be checked.

  procedure ClickButton(); virtual;

  

Calls the Click method for the specified tool button.

  procedure CreateWnd; override;

  

Performs actions needed when the Handle for the control is created.

  procedure AlignControls(); override;

  

Performs actions to align the tool bar buttons in the specified rectangle.

  function FindButtonFromAccel();

  

Gets the tool bar button with the specified accelerator key.

  procedure FontChanged(); override;

  

Performs actions needed when the Font has changed for the control.

  procedure Loaded; override;

  

Performs actions needed when the control has finished loading from the LCL streaming mechanism.

  procedure Notification(); override;

  

Handles notifications for components added or removed from the control.

  procedure Paint; override;

  

Draws the tool bar on the Canvas for the control.

  procedure RepositionButton();

  

Repositions the tool button at the specified position in Buttons.

  procedure RepositionButtons();

  

Repositions the tool buttons on the tool bar.

  function WrapButtons();

  

Adjusts tool button sizes and positions, and handles wrapping to new rows or columns.

  procedure CNDropDownClosed(); message;

  

Handles the CN_DROPDOWNCLOSED control notification message.

  procedure DoAutoAdjustLayout(); override;

  

Applies layout changes using the specified policy and scaling proportions to the control.

public

  constructor Create(); override;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destroy - destructor for TToolBar: frees buttons and links then calls inherited Destroy.

  procedure EndUpdate; override;

  

Finishes an update process for the tool bar.

  procedure FlipChildren(); override;

  

Disables reversing right and left alignment for child controls.

  function GetEnumerator;

  

Gets a TToolBarEnumerator enumerator for the class instance.

  procedure SetButtonSize();

  

Sets the width and height for Buttons on the control to the specified values.

  function CanFocus; override;

  

Always returns False for TToolBar.

  property ButtonCount: Integer; [r]

  

Number of Buttons defined for the tool bar control.

  property Buttons []: TToolButton; [r]

  

Lists with the tool buttons on the tool bar.

  property ButtonList: TList; [r]

  

Contains the Buttons defined for the tool bar control.

  property RowCount: Integer; [r]

  

Number of rows needed to display the buttons for the control.

  property ButtonDropWidth: Integer; [r]

  

Width for the drop-down button indicator.

published

  property Align: TAlign;

  

Specifies the placement of the control inside its Parent.

  property Anchors: TAnchors;

  

The set of anchor definitions for this control.

  property AutoSize: Boolean;

  

Allows automatic adjustment of the size for the control, according to its content.

  property BorderSpacing: TControlBorderSpacing;

  

Determines the inner and outer border spacing for this control.

  property BorderWidth: TBorderWidth;

  

Width of the Border around the control; default is zero.

  property ButtonHeight: Integer; [rws]

  

Contains the height for buttons on the tool bar control.

  property ButtonWidth: Integer; [rws]

  

Contains the width for buttons on the tool bar control.

  property Caption: TCaption;

  

The text displayed for the control.

  property ChildSizing: TControlChildSizing;

  

Provides settings used to resize and align child controls using a tabular layout.

  property Constraints: TSizeConstraints;

  

Contains the minimum and maximum Width and Height for the control.

  property Color: TColor;

  

The background color for the control.

  property DisabledImages: TCustomImageList; [rw]

  

List with images displayed when a tool button is not enabled.

  property DragCursor: TCursor;

  

The cursor shape shown during a drag operation.

  property DragKind: TDragKind;

  

Indicates the action performed for a drag operation: drag-and-drop or drag-and-dock.

  property DragMode: TDragMode;

  

Determines how a drag operation is started for the control.

  property DropDownWidth: Integer; [rws]

  

Width of the drop down arrow button.

  property EdgeBorders: TEdgeBorders;

  

Indicates which edges on the tool bar are drawn with a border.

  property EdgeInner: TEdgeStyle;

  

Specifies the drawing style used for the inner border of the control.

  property EdgeOuter: TEdgeStyle;

  

Specifies the drawing style used for the outer border of the control.

  property Enabled: Boolean;

  

Determines whether the control responds to mouse or keyboard input.

  property Flat: Boolean; [rw]

  

Indicates if the control is drawn with a flat appearance.

  property Font: TFont;

  

The font to be used for text display in this control.

  property Height: Integer;

  

Height for the tool bar control.

  property HotImages: TCustomImageList; [rw]

  

List with images displayed when a button is "hot" or hovered.

  property Images: TCustomImageList; [rw]

  

List with images displayed when a tool button is enabled.

  property ImagesWidth: Integer; [rw]

  

Width for the images displayed on the tool bar.

  property Indent: Integer; [rw]

  

Number of pixels reserved as indentation spacing before buttons and controls on the tool bar.

  property List: Boolean; [rw]

  

Indicates whether buttons on the tool bar are displayed using a list style.

  property ParentColor: Boolean;

  

Use the Color from the Parent control, when enabled.

  property ParentFont: Boolean;

  

Indicates if the Font from the Parent control is used in the control.

  property ParentShowHint: Boolean;

  

If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.

  property PopupMenu: TPopupMenu;

  

A context-sensitive menu that pops up when the right mouse button is clicked over this control.

  property ShowCaptions: Boolean; [rw]

  

Indicates whether captions are displayed on tool bar buttons.

  property ShowHint: Boolean;

  

Enables Hint display for the control.

  property TabOrder: TTabOrder;

  

Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.

  property TabStop: Boolean;

  

Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.

  property Transparent: Boolean; [rw]

  

Indicates whether the control is drawn with transparency.

  property Visible: Boolean;

  

Allows the control, and all of its children, to be displayed or hidden.

  property Wrapable: Boolean; [rw]

  

Controls wrapping of tool buttons to the next row when they are too long for the orientation on the tool bar.

  property OnClick: TNotifyEvent;

  

Notification handler for mouse clicks.

  property OnContextPopup: TContextPopupEvent;

  

Invoked when a context-sensitive pop-up menu is requested.

  property OnDblClick: TNotifyEvent;

  

Event handler signalled when a mouse double click occurs in the control.

  property OnDragDrop: TDragDropEvent;

  

Event handler signalled when an object is dropped onto the control.

  property OnDragOver: TDragOverEvent;

  

Event handler signalled when a control is dragged over the control instance.

  property OnPaintButton: TToolBarOnPaintButton; [rw]

  

Event handler signalled to draw a button on the tool bar.

  property OnEndDrag: TEndDragEvent;

  

Event handler signalled for the end of a drag-drop operation.

  property OnEnter: TNotifyEvent;

  

Event handler signalled when the control receives focus.

  property OnExit: TNotifyEvent;

  

Event handler signalled when the control loses focus.

  property OnMouseDown: TMouseEvent;

  

Event handler signalled when a mouse down event is handled for the control.

  property OnMouseEnter: TNotifyEvent;

  

Event handler signalled when the mouse pointer has entered the control.

  property OnMouseLeave: TNotifyEvent;

  

Event handler signalled when the mouse pointer has left the control.

  property OnMouseMove: TMouseMoveEvent;

  

Event handler signalled when the mouse pointer is moved in the control.

  property OnMouseUp: TMouseEvent;

  

Event handler signalled when a mouse up event is handled for the control.

  property OnMouseWheel: TMouseWheelEvent;

  

Event handler for mouse wheel turned.

  property OnMouseWheelDown: TMouseWheelUpDownEvent;

  

Event handler signalled for a downward movement of the mouse wheel.

  property OnMouseWheelUp: TMouseWheelUpDownEvent;

  

Event handler signalled for an upward movement of the mouse wheel.

  property OnPaint: TNotifyEvent; [rw]

  

Event handler signalled when the Paint method is called for the control.

  property OnResize: TNotifyEvent;

  

Notification handler for a resize of the control.

  property OnChangeBounds: TNotifyEvent;

  

Event handler signalled when the Bounds for the control have been changed.

  property OnStartDrag: TStartDragEvent;

  

Event handler signalled for the start of a dragging operation.

end;

Inheritance

TToolBar

  

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

|

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,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

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

TToolButton

  

TToolButton is a button control used in a TToolBar object.

TToolWindow

  

Implements a control which can paint its client area with borders.


Version 3.2 Generated 2024-02-25 Home