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

TWinControl.DoSetBounds

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

Declaration

Source position: controls.pp line 2188

protected procedure TWinControl.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

TControl.DoSetBounds

  

Internal function used to set the bounds for the control (Left, Top, Height, Width).

TControl.Left

  

The client coordinate with the left edge for the control.

TControl.Top

  

The client coordinate for the top edge of the control.

TControl.Width

  

The horizontal size for the control.

TControl.Height

  

The vertical size for the control.


Version 3.2 Generated 2024-02-25 Home