Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


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


Source position: controls.pp line 2276

public property TWinControl.Handle : HWND
  read GetHandle
  write SetHandle;


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



Checks whether a handle for the widget has been allocated for the control.



Call this method when your code requires a valid Handle for this control.



Creates the Handle for the widget, if not already created.



Creates the interface object (widget) and assigns the value in Handle.



For internal use; allows direct access to the Handle for the control, bypassing any getter/setter methods.



Returns True if all Parents have handles allocated, and are not being destroyed.

CT Web help

CodeTyphon Studio