Sign in Join
FPDoc Onlineexperiment

TCustomForm.CalculatePreferredSize procedure

Member of TCustomFormprotectedIn unit Forms

Calculates the clipping width and height for a top-level form on the monitor WorkArea.

Declaration

pascal
procedure CalculatePreferredSize(var PreferredWidth: Integer; 
 var PreferredHeight: Integer; 
 WithThemeSpace: Boolean); override

Arguments

PreferredWidth

Default width for a new instance of the class.

PreferredHeight

Default height for a new instance of the class.

WithThemeSpaceTrue if additional space is reserved for theme element details.

Description

CalculatePreferredSize is an overridden method in TCustomForm. It calls the inherited method on entry to calculate the default dimensions for the new class instance, and to notify the widgetset class when its Handle has been allocated.

CalculatePreferredSize ensures that a form anchored to the bottom or right fits within the WorkArea rectangle on the Monitor. The value in PreferredWidth or PreferredHeight is updated when Anchors contains akRight or akBottom.

See also

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