Tech Tip: Continuously tracking the position of the mouse
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: July 14, 2006
To continuously keep variable updated with the mouse coordinates, you can use a combination of the On Timer form event and the GET MOUSE command. A following example will set the timer to update the mouse position every 1/4th of a second.
Case of
: (Form event=On Load )
` these two variables will hold mouse button coordinates
C_LONGINT(mouseXcoord, mouseYcoord)
` sets the timer to fire every second
SET TIMER(15)
: (Form event=On Timer )
C_LONGINT($mouseButton)
` get mouse coordinates
GET MOUSE(mouseXcoord, mouseYcoord,$mouseButton)
End case