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

TApplication.GetControlAtPos

Gets the control which contains the specified position, and optionally updates the internal tracking members for mouse capture when needed.

Declaration

Source position: forms.pp line 1602

public function TApplication.GetControlAtPos(

  P: TPoint

):TControl;

Arguments

P

  

TPoint instance with the horizontal and vertical screen coordinates for a control to locate in the method.

Function result

Control with bounds which include the specified position.

Description

GetControlAtPos is a TControl function used to get the control which contains the point specified in P. The X and Y members in P are screen coordinates.

GetControlAtPos compares the coordinates in P to existing tracking members used for the last active control in the application. When the members are both valid and equivalent to P, the previous active control is used in the return value. Otherwise, FindControlAtPos is called to locate the control under the position in P.

The return value is Nil if a control is not found for the specified position, or when called at design-time. When the return value is assigned, the internal tracking members are updated for the last active control, its position, and the valid state for the members.

GetControlAtPos is used in the implementation of the GetControlAtMouse method, and in private TControl methods.

Version info

Added in LCL version 4.0.

See also

TApplication.GetControlAtMouse

  

Gets the control under the mouse pointer.


Version 3.2 Generated 2024-02-25 Home