Sign in Join
FPDoc Onlineexperiment

TWinControl.Handle property

Member of TWinControlpublicIn unit Controls

A reference handle to the widgetset class instance associated with this control.

Declaration

pascal
property Handle: HWND read GetHandle write SetHandle;

Description

Handle is a HWND property which represents the handle to the widgetset class instance for the control. It provides a bi-directional communication mechanism between an LCL component and the native control on a given platform or widgetset. Handle has a non-zero value when it has been allocated for the widget.

Read access to the property value calls the HandleNeeded method to create the handle if it does not already exist in the control (and its Parent controls). When the property value is changed, the InvalidatePreferredSize method is called to update control flags and clear the cached size for the control.

Use HandleAllocated to check Handle for a non-zero value. Use HandleNeeded when the LCL component needs to ensure that the control and Parent controls have an assigned Handle. Or call CreateHandle.

Use WindowHandle to access the unique identifier for a device context used in drawing operations for the widgetset class.

See also

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