Mouse
This command does for your resident rodent what KEYBOARD does for your keyboard—lets you make things happen automatically. Of course, just as using KEYBOARD doesn't actually depress the keys, MOUSE doesn't physically move or click your real mouse—it just makes it seem like you did.
Usage |
MOUSE [ CLICK | DBLCLICK ] [ AT nRow, nCol ] [ DRAG TO nEndRow1, nEndCol1 [, nEndRow2, nEndCol2 ... ] ] [ PIXELS ] [ WINDOW WindowName ] [ LEFT | MIDDLE | RIGHT ] [ ALT ] [ CONTROL ] [ SHIFT ] |
In VFP 3 and VFP 5, when you use the WINDOW clause, the title bar is included in the window, so (0,0) is not the first point inside the window, but something above and to the left of it. In VFP 6 and later, the title bar no longer counts. |
In VFP 3, two of the optional keywords are messed up. MIDDLE generates an error in that version. When VFP 3 came out, few users had three-button mice, so MIDDLE was no big loss. The second problem is only a documentation bug. The docs for VFP 3 say to use CTRL to have the Ctrl button "pressed" with your click. Nope, it's CONTROL instead. Bad choice, since other parts of the language (KEYBOARD, in particular) use CTRL, and that's what it says on our keyboards. Both problems are fixed in later versions, but it would have been nicer if they'd used the same keyword as everywhere else. |
Example |
* Say we've selected some objects and used ASELOBJ() to * store references to them in aObjs. Later, we can reselect * them. LOCAL nCnt, nTitleSpace, nBorderSpace * We need to add space for the title bar of both the Form * Designer and the form itself vertically, and the borders of * the Form Designer horizontally. nTitleSpace = 2 * SYSMETRIC(9) nBorderSpace = 2 * SYSMETRIC(3) MOUSE CLICK AT -1,-1 WINDOW (WONTOP()) && To clear selections FOR nCnt = 1 TO ALEN(aObjs,1) MOUSE CLICK AT aObjs[nCnt].Top + nTitleSpace , ; aObjs[nCnt].Left + nBorderSpace ; WINDOW (WONTOP()) PIXELS SHIFT ENDFOR |
See Also |
Click, DblClick, Keyboard, MCol(), MiddleClick, MouseDown, MouseUp, MouseMove, MRow(), RightClick |