Sign in Join
FPDoc Onlineexperiment

TWinControl.DoSetBounds procedure

Member of TWinControlprotectedIn unit Controls

Updates the size and extent of the control as well as its ClientRect.

Declaration

pascal
procedure DoSetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; 
 AHeight: Integer); override

Arguments

ALeft

New value for the Left property in the control.

ATop

New value for the Top property in the control.

AWidth

New value for the Width property in the control.

AHeight

New value for the Height property in the control.

Description

DoSetBounds is an overridden method in TWinControl. It keeps a copy of the current Width and Height prior to calling the inherited method to apply the argument values to the Left, Top, Width and Height properties.

It performs actions to adjust the CachedClientWidth and CachedClientHeight if the control flags do not indicate they are being loading or have already been loaded for the control. Changing the ClientRect here, to the most probable size, reduces unnecessary resize messages.

Normally, the ClientWidth / ClientHeight are adjusted automatically by the widget. But it is up to the widget when this will be done. GTK, for example, just puts resize requests in a queue. The LCL would resize the child components immediately after the GTK procedure to adjust the ClientRect. On complex forms with lots of nested controls, this would result in thousands of resize messages.

See also

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