Cicode Programming Reference > Cicode Function Categories > Display Functions > DspGetMouse

DspGetMouse

Gets the x and y coordinates of the mouse position, relative to the top left corner of the window.

Syntax

DspGetMouse(X, Y)

X:

A locally declared variable used to store the x pixel coordinate of the mouse position, returned from this function.

Y:

A locally declared variable used to store the y pixel coordinate of the mouse position, returned from this function.

Note: Locally declared Cicode variables need to be used for X and Y, otherwise an "Incompatible Type" compile error may be generated.

Return Value

0 (zero) if successful, otherwise an error is returned. The X and Y variables are set to the mouse position.

Related Functions

KeyGetCursor, DspAnGetPos, DspGetMouseOver, DspGetNearestAn, PageTransformCoords

Example

! If the mouse cursor is at x,y pixel coordinate 43,20;
DspGetMouse(X,Y);
! Sets X to 43 and Y to 20.

See Also

Display Functions

Published June 2018