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

TToolButton.Style

Determines the display style for the tool button.

Declaration

Source position: comctrls.pp line 2214

published property TToolButton.Style : TToolButtonStyle
  read FStyle
  write SetStyle
  default tbsButton;

Description

Style is a TToolButtonStyle property which controls the visual display style and behavior for the button on its tool bar. Values allowed in the property include:

The default value for the property is tbsButton. This causes the button to be displayed using the behavior for a TSpeedButton class instance. In other words, it is a momentary button which performs its Click method when the left mouse button is clicked and released.

See TToolButtonStyle for more information about the values for the property.

Changing the value for the property causes the Width, Height, and preferred size for the button to be recalculated. If the button is Visible, the visible area on the Parent tool bar is redisplayed by calling UpdateVisibleToolbar.

Use Grouped and AllowAllUp to control button behavior for adjacent grouped buttons on the tool bar using the checked style.

Use the Caption and ShowCaption properties to control the text displayed on the button.

See also

TToolButton.Grouped

  

Indicates if the tool button is a member of a group. The default value is False.

TToolButton.AllowAllUp

  

Indicates if all buttons in a group can have their Down property set to False.

TToolButton.DropdownMenu

  

The drop-down menu displayed when the button is pressed.

TToolButton.Visible

  

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

TToolButton.Width

  

The horizontal size for the control.

TToolButton.Height

  

Contains the height for the control in pixels.

TToolButton.UpdateVisibleToolbar

  

Calls the corresponding method in the tool bar for the button.

TToolBar.List

  

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

TToolBar.ShowCaptions

  

Indicates whether captions are displayed on tool bar buttons.

TToolButtonStyle

  

Enumerated type with values representing the display styles and behaviors for buttons on a TToolBar control.

Example

{ To use this example, create a new application and add the example code
  to the unit. Remember to add the ComCtls unit in the uses clause. }

procedure AddButtons(ToolBar: TToolBar; const ButtonCaptions: array of String);
var
  i: integer;
begin
  for i := 0 to High(ButtonCaptions) do
  begin
    with TToolButton.Create(ToolBar) do
    begin
      Parent := ToolBar;
      Caption := ButtonCaptions[i];
      if (ButtonCaptions[i] = '|') then
        Style := tbsSeparator
      else
        Style := tbsButton;
      AutoSize := True;
    end;
  end;
end;


procedure TForm1.FormCreate(Sender: TObject);
var
  ToolBar: TToolBar;
begin
  ToolBar := TToolBar.Create(Self);
  ToolBar.Parent := Self;
  ShowMessage(IntToStr(ToolBar.ButtonCount));
  AddButtons(ToolBar, ['New', 'Save', '|', 'Cut', 'Copy', 'Paste']);
  ToolBar.ShowCaptions := True;
  ToolBar.Height := 40;
  ToolBar.ButtonWidth := 75;
  ShowMessage(IntToStr(ToolBar.ButtonCount));
end;

Version 3.2 Generated 2024-02-25 Home