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

TControl.ClientWidth

The width of the client area for the control.

Declaration

Source position: controls.pp line 1799

public property TControl.ClientWidth : Integer
  read GetClientWidth
  write SetClientWidth
  stored IsClientWidthStored;

Description

ClientWidth is an Integer property with the number of pixels need for the horizontal client area on the control. The property contains the value from the Right member in ClientRect. Changing the value for ClientWidth causes SetClientSize to be called to apply the new property value and the existing ClientHeight for the control.

The value for ClientWidth is not stored or used to set the Width for the control during LCL component streaming. It is used, however, when AutoSizing is restored and when auto-layout policies using Anchors are applied to the control. For example, when Anchors is set to [akRight] the value in ClientWidth is needed / used.

Remark: In the LCL, ClientWidth has the same value as Width. Derived classes (like TCustomForm or TForm) may implement a ClientWidth property that differs from Width - but in the current LCL version, they do not. This differs from the behavior in the Delphi VCL where a TForm instance adjusts the value in ClientWidth to remove pixels used in non-client areas like the borders, frames, and scroll bars. LCL uses this approach because there is no reliable way to determine the sizes for all of the non-client areas on all of the platforms where LCL is supported. Without a reliable way, the LCL would needlessly move the forms around on the screen or resize them endlessly. In the LCL, neither Width nor ClientWidth include the non-client area on a form instance.

Use ClientHeight to access the number of pixels needed for the vertical client area on the control.

See also

TControl.ClientRect

  

Size of the client area for the control.

TControl.ClientHeight

  

The height for the client area on the control.

TControl.Width

  

The horizontal size for the control.

TControl.AutoSizing

  

Contains True while auto-sizing is in progress.

TControl.EnableAutoSizing

  

Enables automatic sizing for the control.

TControl.AutoAdjustLayout

  

Applies an automatic adjustment layout policy to the control.

TControl.Resize

  

Checks for changes and calls DoOnResize if needed.

TControl.Anchors

  

The set of anchor definitions for this control.


Version 4.0 Generated 2025-05-03 Home