Sign in Join
FPDoc Onlineexperiment

TToolBar.CalculatePreferredSize procedure

Member of TToolBarprotectedIn unit ComCtrls

Calculates the preferred size (width and height) for the control.

Declaration

pascal
procedure CalculatePreferredSize(var PreferredWidth: Integer; 
 var PreferredHeight: Integer; 
 WithThemeSpace: Boolean); override

Arguments

PreferredWidth

Preferred width for the control.

PreferredHeight

Preferred height for the control.

WithThemeSpace

Indicates whether additional space is reserved for theme element details. Not used in the method.

Description

CalculatePreferredSize is an overridden method in TToolBar used to get the preferred dimensions for the control. The width and height values are used by the LCL auto-sizing and layout algorithms as the default size. CalculatePreferredSize reimplements the method introduced in ancestor classes, and does not call the inherited methods.

In TToolBar, CalculatePreferredSize ensures that minimum and maximum widths defined in Constraints are respected when the control is aligned to a fixed-width parent control. If the control does not have a parent, or the parent control is auto-sized, the Width size constraint for the Screen is used instead.

The sizes and positions for the Buttons on the tool bar are determined for the width. The calculated width or height values are adjusted (when needed) for the layout of the buttons.

CalculatePreferredSize stores and returns the width and height values in the PreferredWidth and PreferredHeight arguments. Only positive values are valid. Negative or 0 (Zero) values are treated as undefined, and the LCL uses other values to perform auto-sizing and layout.

The WithThemeSpace parameter is not used in the method.

See also

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