[Overview][Types][Classes][Index] | Reference for unit 'GroupedEdit' (#lcl)

# TCustomAbstractGroupedEdit.CalculatePreferredSize

Calculates the preferred size for the control with optional space reserved by theme services.

## Declaration

Source position: groupededit.pp line 180

`protected procedure TCustomAbstractGroupedEdit.CalculatePreferredSize(`
`var PreferredWidth: Integer;`
`var PreferredHeight: Integer;`
`WithThemeSpace: Boolean`
`); override;`

## Arguments

`PreferredWidth` |  | Width for the control; always zero in the method.
`PreferredHeight` |  | Height for the control.
`WithThemeSpace` |  | Indicates if additional space needed for theme services is reserved.

## Description

CalculatePreferredSize is an overridden procedure used to calculate the dimensions for the control. The calculated values are returned in PreferredWidth and PreferredHeight.

CalculatePreferredSize calls the inherited method, and forwards the method call to the BaseEditor control. When AutoSizeHeightIsEditHeight is set to True, the value calculated as the control height in BaseEditor is used as the value in the PreferredHeight argument. The value in PreferredWidth is always set to zero (0).

## See also

TCustomAbstractGroupedEdit.AutoSizeHeightIsEditHeight |  | Indicates if the height for BaseEditor is used as the height for the control when auto-sizing.
TWinControl.CalculatePreferredSize |  | Override this method to return a different preferred height and/or width for auto-sizing.