[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TToolButton.GetPreferredSize

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

## Declaration

Source position: comctrls.pp line 2190

`public procedure TToolButton.GetPreferredSize(`
`var PreferredWidth: Integer;`
`var PreferredHeight: Integer;`
`Raw: Boolean = False;`
`WithThemeSpace: Boolean = True`
`); override;`

## Arguments

`PreferredWidth` |  | Preferred width for the control used in auto-sizing algorithms.
`PreferredHeight` |  | Preferred height for the control used in auto-sizing algorithms.
`Raw` |  | True if the calculated values are used as is. False if the value can be adjusted by constraints or set to default values.
`WithThemeSpace` |  | True to reserve space for stacking and alignment provided in theme element details.

## Description

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

When WithThemeSpace is True, additional space is reserved for stacking.

Calls the inherited method on entry. Values from the ButtonWidth and ButtonHeight properties in the parent tool bar may be used in the PreferredWidth and PreferredHeight arguments, depending on the orientation for the tool bar. No additional actions are performed in the method if the parent tool bar has not been assigned.

## See also

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