Desktop Application Object - ControlAtPoint Method
Returns the control at the specified location
Member of Desktop Application Object (PRIM_APPL)
Parameters
Name | Type | Data Type | Description |
|---|---|---|---|
Control | *Result (Optional) | Control in which to search | |
Left | *Input (Optional) | Integer | Left position in pixels |
Top | *Input (Optional) | Integer | Top position in pixels |
ControlPart | *Output (Optional) | Reference to the Control at the specified point |
Details
The ControlAtPoint property returns a reference to the control currently under the mouse pointer.
Example
In this example, when the hover event fires on the panel, ControlAtPoint is used to determine the control currently under the mouse.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(172) Clientwidth(364) Height(211) Left(137) Top(198) Width(380)
Define_Com Class(#PRIM_VS.Style) Name(#Style1) Backgroundbrush(#Brush1)
Define_Com Class(#PRIM_VS.SolidBrush) Name(#Brush1) Color(Theme100)
Define_Com Class(#PRIM_PANL) Name(#Panel) Displayposition(1) Left(16) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(15) Height(146) Width(337) Style(#Style1)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') Displayposition(1) Left(28) Parent(#Panel1) Tabposition(1) Top(32)
Define_Com Class(#PRIM_PHBN) Name(#Button2) Caption('Button2') Displayposition(2) Left(128) Parent(#Panel1) Tabposition(2) Top(32)
Define_Com Class(#PRIM_PHBN) Name(#Button3) Caption('Button3') Displayposition(3) Left(224) Parent(#Panel1) Tabposition(3) Top(32)
Evtroutine Handling(#Panel.MouseHover)
#Com_owner.Caption := #sys_appln.ControlAtPoint.Name
Endroutine
End_Com