MouseMove
Have you ever wanted to do something just because the mouse moved over a particular point on the screen? We have (although providing tooltips, the thing we've most wanted to do, is built into Visual FoxPro). MouseMove is the key to reacting to the rodent's movements.
Usage |
PROCEDURE oObject.MouseMove LPARAMETERS [ nIndex , ] nButtons, nKeys, nXCoord, nYCoord |
Example |
PROCEDURE MouseMove * Tell the user what's going on. LPARAMETERS nButton, nShift, nXCoord, nYCoord DO CASE CASE nButton = 0 cButton = "No buttons" CASE nButton = 1 cButton = "Left" CASE nButton = 2 cButton = "Right" CASE nButton = 3 cButton = "Left and Right" CASE nButton = 4 cButton = "Center" CASE nButton = 5 cButton = "Left and Center" CASE nButton = 6 cButton = "Center and Right" CASE nButton = 7 cButton = "All three" OTHERWISE cButton = "That's odd!" ENDCASE DO CASE CASE nShift = 0 cShift = "No keys" CASE nShift = 1 cShift = "Shift" CASE nShift = 2 cShift = "Ctrl" CASE nShift = 3 cShift = "Shift+Ctrl" CASE nShift = 4 cShift = "Alt" CASE nShift = 5 cShift = "Shift+Alt" CASE nShift = 6 cShift = "Ctrl+Alt" CASE nShift = 7 cShift = "All three" OTHERWISE cShift = "That's odd!" ENDCASE DEBUGOUT "Moving over " + This.Name + ; " at " + LTRIM(STR(nXCoord)) + "," + ; LTRIM(STR(nYCoord)) + " with " + ; cButton + ", " + cShift NOWAIT * A shorter, but less readable, way to test for the different * conditions is to use BitTest as follows: lLeft = BitTest(nButton,0) lRight = BitTest(nButton,1) lCenter = BitTest(nButton,2) lShift = BitTest(nShift,0) lCtrl = BitTest(nShift,1) lAlt = BitTest(nShift,2) |
See Also |
Click, DblClick, DragOver, Mouse, MouseDown, MouseEnter, MouseLeave, MousePointer, MouseUp, MouseWheel |