MouseX

[property icon] MouseX

Returns the current mouse position within a Click() event

Read-only Runtime-only Integer property

Applies to: Grid , Picture Button , Rich Edit , Tree


>

MouseX

This property is used to return the horizontal mouse position at the time a Click() event was triggered. This property can be used in conjunction with the MouseY property to position a popup menu onto the button at the exact location where the mouse was clicked. Note that the position is returned relative to the top left hand corner of the button. Therefore to place a control at the exact location where the user clicked you must add the Top and Left positions of the control to the MouseX and MouseY properties. For example, the following event handler would place a menu at the location of the last left mouse click:

-DEFEVENT Form1.picControl1.LeftClick()
 .menu1.TrackPopup(..top + ..MouseY, ..left + ..MouseX)
 END EVENT

Note: It is recommended to use MouseFormX for all future development as it saves having to factor in the control's own position (especially when the control is on a tab page). This is especially true for a Pocket PC based device as the form may be scrolled in which case the calculated value would be completely wrong.

Grid

This property is used to return the horizontal mouse position at the time a LeftClick() or RightClick() event was triggered for a KCML grid control. This property can be used in conjunction with the MouseY property to position a popup menu onto the grid at the exact location where the mouse was clicked. Note that the position is returned relative to the top left hand corner of the grid control. Therefore to place a control at the exact location where the user clicked you must add the Top and Left positions of the control to the MouseX and MouseY properties. For example, the following event handler would place a menu at the location of the last left mouse click:

-DEFEVENT Form1.GridControl1.LeftClick()
 .menu1.TrackPopup(..top + ..MouseY, ..left + ..MouseX)
 END EVENT

Note: It is recommended to use MouseFormX for all future development as it saves having to factor in the control's own position (especially when the control is on a tab page).

Note: The LeftAction and RightAction properties must be set appropriately to activate the LeftClick() and RightClick() event handlers.

RichEdit

This property returns the horizontal mouse position at the time a RightClick() event was triggered for a RTF control. This property can be used in conjunction with the MouseY property to position a control, normally a popup menu, onto the RTF editing area at the exact location where the mouse was right clicked. Note that the position is returned relative to the top left hand corner of the RTF control, therefore to place a control at the exact location where the user clicked you must add the Top and Left properties of the control to the MouseX and MouseY properties. For example, the following would position a popup menu at the location of the right mouse click:

-DEFEVENT Form1.RTFControl1.RightClick()
 .menu1.TrackPopup(..MouseX + ..Left, ..MouseY + ..Top)
 END EVENT

Note: It is recommended to use MouseFormX for all future development as it saves having to factor in the control's own position (especially when the control is on a tab page).

Tree

This property is used to return the horizontal mouse position at the time a LeftClick() or RightClick() event was triggered for a Tree control. This property can be used in conjunction with the MouseY property to position a popup menu onto the control at the exact location where the mouse was clicked. Note that the position is returned relative to the top left hand corner of the control. Therefore to place a menu at the exact location where the user clicked you must add the Top and Left positions of the control to the MouseX and MouseY properties. For example, the following event handler would place a menu at the location of the last left mouse click:

 -DEFEVENT Form1.TreeControl1.LeftClick()
   .menu1.TrackPopup(..top + ..MouseY, ..left + ..MouseX)
  END EVENT

Note: It is recommended to use MouseFormX for all future development as it saves having to factor in the control's own position (especially when the control is on a tab page).

See also

Grid methods, properties and events. Picture Button methods, properties and events. Rich Edit methods, properties and events. Tree methods, properties and events.