Hackers Guide to Visual FoxPro 7.0
MRow(), MCol(), MWindow(), MDown()
These functions let you find out what's going on with the mouse. MROW() and MCOL() provide the current mouse position, while MWINDOW() tells you which window the mouse is in. MDOWN() tells you whether a mouse button is down at the moment. You can get just about all the same information using various events including MouseMove and MouseDown.| Usage | nYCoord = MROW( [ cWindow ] ) nXCoord = MCOL( [ cWindow ] ) |
| Parameter | Value | Meaning |
| cWindow | Character | Return coordinates relative to the specified window. |
| Omitted | Return coordinates relative to the active window. If no user-defined window is active, return coordinates relative to the main Visual FoxPro window. |
MROW() and MCOL() have interesting behavior. Their output is always relative to a particular window and is given in foxels. When a user-defined window is active, these functions are dynamic. You can watch them change in the Debugger. When no user-defined window is active, the Debugger values update only when you click somewhere. No doubt the difference is the presence of the MouseMove event of a form, which tracks the mouse position anyway.
When the mouse is positioned outside the specified window in either dimension, the function for that dimension returns –1. (For example, if the mouse is below the window, MROW() returns –1.) When the Debugger is in its own frame, clicking into it evaluates these functions with respect to the position of the VFP frame. Kind of strange, but not terribly important since users aren't likely to run your apps with the Debugger open.| Usage | cWindow = MWINDOW() lIsThisWindow = MWINDOW( cWindow ) |
| Usage | lButtonDown = MDOWN() |
| Example | DO WHILE MDOWN() * increase a variable while the mouse button is down nCount = nCount+1 ENDDO |
| See Also | Click, MiddleClick, MouseDown, MouseMove, MouseUp, RightClick, WOnTop(), WOutput() |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.
Категории