RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TWinControl.ControlAtPos Method

Returns the child control located at a specified position within the control.

Pascal
function ControlAtPos(const Pos: TPoint; AllowDisabled: Boolean; AllowWinControls: Boolean = False; AllLevels: Boolean = False): TControl;
C++
__fastcall TControl * ControlAtPos(const TPoint Pos, Boolean AllowDisabled, Boolean AllowWinControls = False, Boolean AllLevels = False);

Use ControlAtPos to determine which child control is at the specified location within the control. ControlAtPos returns an immediate child of the control; that is, one of the entries of the Controls property, that has this control for its Parent property. 

Specify the position in client coordinates as the value of the Pos parameter. Pos can be anywhere within the boundaries of the child control, not just the upper left corner. 

The AllowDisabled parameter determines whether the search for controls includes disabled controls. 

The AllowWinControls parameter determines whether descendants of TWinControl are considered when looking for the child control. 

If there is no control that matches the AllowDisabled and AllowWinControls parameters at the specified position, ControlAtPos returns nil (Delphi) or NULL (C++). 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!