AMouseObj()
This function, added in VFP 6, gives you information about the current position of the mouse pointer.
Usage |
nFoundSomething = AMouseObj( Info [, nRelativeToForm ] ) |
Parameter |
Value |
Meaning |
Info |
Array Name |
The array to hold the results of the function. |
nRelativeToForm |
Omitted |
Return information about the mouse position relative to the container of the object over which the mouse is positioned. |
1 (or any other value) |
Return information about the mouse position relative to the containing form. |
|
nFoundSomething |
4 |
The mouse is positioned over an object and the array has been filled with the information. |
0 |
The mouse is positioned over something that's not an object in the sense of this function and the array is unchanged. |
The function doesn't handle grids properly. When you call AMouseObj() with the mouse over a grid column (either the header or the control in the grid) and omit the second parameter, both object references point to the column. Sounds like somebody can't decide how deep to drill here. The GridHitTest method can help you work around this one. |
You need to release the array (or at least null the first two elements) before you can release the form. Otherwise, the references in the array prevent the form from being destroyed. |
Example |
* Find out if we're over a particular object IF AMouseObj(aWhereAreWe) = 4 * Got something IF aWhereAreWe[1] = oSomeObject && note that we can now && compare objects directly * Do something ELSE * Do something different ENDIF ENDIF |
See Also |