Sign in Join
FPDoc Onlineexperiment

TCustomControlBar.CalculatePreferredSize procedure

Member of TCustomControlBarprotectedIn unit ExtCtrls

Calculates the preferred height and width used during auto-sizing.

Declaration

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

Arguments

PreferredWidth

Preferred width for a new instance of the control, or 0 to enable auto-sizing.

PreferredHeight

Preferred height for a new instance of the control, or 0 to enable auto-sizing.

WithThemeSpace

Ignored in TCustomControlBar.

Description

CalculatePreferredSize is an overridden method in TCustomControlBar. It re-implements the method from the ancestor class.

CheckBandsSizeAndVisibility is called to initialize the TCtrlBand instances on the control, and to order the bands which have visible controls by their display coordinates.

PreferredWidth and PreferredHeight are variable arguments which contain the preferred dimensions for a new instance of the control. In TCustomControlBar, PreferredWidth is set to 0 to trigger the auto-sizing feature specified in ControlStyle. PreferredHeight is set to the value from the CalcLowestBandBottomPx method, and actually contains the largest value in the Bottom property for the visible controls on the control bands. A positive non-zero value in PreferredHeight also includes the space needed for inner bevels on the control bands.

CalculatePreferredSize is called when LCL auto-sizing algorithms are executed for the control.

See also

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