Sign in Join
FPDoc Onlineexperiment

TControl.GetPreferredSize procedure

Member of TControlpublicIn unit Controls

Returns default/preferred height and width, for use in auto-sizing.

Declaration

pascal
procedure GetPreferredSize(var PreferredWidth: Integer; 
 var PreferredHeight: Integer; 
 Raw: Boolean=False; 
 WithThemeSpace: Boolean=True); virtual

Arguments

PreferredWidth

Default width for a new instance of the control.

PreferredHeight

Default height for a new instance of the control.

Raw

When False, the values will be adjusted by the constraints, and undefined values will be replaced by GetDefaultWidth/GetDefaultHeight.

WithThemeSpace

If True, adds space for stacking.

Description

Called during AutoSize calculations. Only positive values are valid. Negative or 0 are treated as undefined and the LCL uses other sizes instead.

WithThemeSpace: If True, adds space for stacking.

For example: TRadioButton has a minimum size. But for stacking multiple TRadioButtons there should be some space around. This space is theme dependent, so the parameter is passed to the widgetset

TWinControl overrides this and asks the interface for theme dependent values. See CalculatePreferredSize for more information.

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