MouseDevice.GetCursorPos (Method)
Returns the x and y coordinates for the current mouse cursor position to xCoordinate and yCoordinate, respectively.
Syntax
MouseDevice.GetCursorPos xPos As Long, yPos As Long
Parameters
NameTypeDescription
xPosLongCoordinate can be the X property of a structure of type Point.
yPosLongCoordinate can be the Y property of a structure of type Point.
Description
xCoordinate and yCoordinate are of type Long

To retrieve only one of the coordinates, use MouseDevice.CursorX or MouseDevice.CursorY.
Example
'This example retrieves the current cursor position. 'EXAMPLE PART A Instructions.Text = "Press the spacebar to " &_ "begin the \n Mouse.GetCursorPos demo..." 'EXAMPLE PART B Dim ptPress As Point Mouse.ShowCursor True Mouse.GetCursorPos ptPress.x, ptPress.y Display.Canvas.Clear Display.Canvas.Text 0, 0, "X is " & ptPress.x & " Y is " & ptPress.y Sleep 2000 Mouse.ShowCursor False Display.Canvas.Text 0, 25, "End of mouse get " &_ "cursor position demonstration" Sleep 2000 'terminate the rest of the experiment TextStimulus.Duration = 0 'do not display the normal TextStimulus TrialList.Terminate 'do not cycle 'Note: To run this example with E-BasicExample.es2, copy the script in 'EXAMPLE PART A above and paste it into the Setup InLine object. Next 'copy the script in EXAMPLE PART B above and paste it into the PreStimulus 'InLine object.
See Also
MouseDevice (Object)