Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


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


Source position: controls.pp line 1595

public procedure TControl.GetPreferredSize(

  var PreferredWidth: Integer;

  var PreferredHeight: Integer;

  Raw: Boolean = False;

  WithThemeSpace: Boolean = True

); virtual;




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



If True, adds space for stacking.


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 TWinControl.CalculatePreferredSize for more information.

CT Web help

CodeTyphon Studio