Sign in Join
FPDoc Onlineexperiment

TToolBar.SetButtonSize procedure

Member of TToolBarpublicIn unit ComCtrls

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

Declaration

pascal
procedure SetButtonSize(NewButtonWidth: Integer; 
 NewButtonHeight: Integer)

Arguments

NewButtonWidth

New value for the ButtonWidth property.

NewButtonHeight

New value for the ButtonHeight property.

Description

SetButtonSize is a convenience method used to assign values for the ButtonWidth and ButtonHeight properties in a single method call. It is called when a new value is assigned to the ButtonWidth or ButtonHeight properties.

For example:

AToolbar.SetButtonSize(32, 30);

is equivalent to:

AToolbar.ButtonWidth := 32;
AToolbar.ButtonHeight := 30;

The existing value in the property is kept when it is the same as the new value. No actions are performed in the method when neither value has been changed, or when BeginUpdate has already been called.

SetButtonSize visits each of the Buttons on the control to apply the changed values to the corresponding TToolButton properties. The button might not be updated if any of the following conditions are found.

For button width:

  • The new value is 0.
  • The new value is too small for the width needed in a check box or drop-down style button.
  • The tool button has AutoSize enabled.
  • The control is not derived from TToolButton.

For button height:

  • In horizontal toolbars the height is set by the toolbar independent of the assigned size.

SetButtonSize calls the SetBounds method in each tool bar button to apply the values in NewButtonWidth and NewButtonHeight.

See also

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