TToolButton.CalculatePreferredSize procedure
Calculates the preferred dimensions for new instances of the control.
Declaration
procedure CalculatePreferredSize(var PreferredWidth: Integer;
var PreferredHeight: Integer;
WithThemeSpace: Boolean); overrideArguments
PreferredWidth | Returns the preferred width for a new instance of the tool button class. |
PreferredHeight | Returns the preferred height for a new instance of the tool button class. |
WithThemeSpace | Not used in the current implementation. |
Description
CalculatePreferredSize is an overridden method in
TToolButton. It returns the calculated width and height for the
control in the
PreferredWidth and
PreferredHeight
variable arguments. It re-implements the method introduced in TControl to
return non-empty values in the arguments.
No actions are performed in the method if a TToolBar instance has not been assigned as the Parent for the control. In this case, the values in the PreferredWidth and PreferredHeight arguments are not changed from their values on entry.
WithThemeSpace indicates whether additional space is reserved for
theme element details. It is not used in the current implementation of the
method.
CalculatePreferredSize calculates the size needed to represent the icon and text on the control. The value in Style determines whether the icon and/or text values are needed in the calculated values. When both are needed, additional space is reserved between the icon and text as indicated in the cHorIconTextDist or cVerIconTextDist constants. The number of pixels is scaled to the PPI setting for the control Font and applied to the calculated values.
CalculatePreferredSize includes space (when needed) for a frame around the control, a drop-down indicator, or the height / width for a divider or separator button. The Style property determines which values are required.
CalculatePreferredSize is called form the GetPreferredSize method when it has not already been called for the class instance.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
