Reads theposition of the interactive graphics cursor from the current graphics device.
UNIX and OpenVMS Users: Not all wait modes work with all display devices. Many devices, such as Tektronix terminals, do not have the ability to return immediately, and so always wait. In addition, not all types of waiting are available for devices that do not have the ability to sense transitions or states.
y A named variable to receive the cursor's current row.
Data If present and nonzero, causes the values placed into x and y to be in data coordinates (the default).
Device If present and nonzero, causes the values placed into x and y to be in device coordinates.
Down Waits for a button down transition within the currently selected window.
Normal If present and nonzero, causes the values placed into x and y to be in normalized coordinates.
Nowait Reads the pointer position and button status and return immediately. If the pointer is not within the currently selected window, the device coordinates -1, -1 are returned.
Up Waits for a button up transition within the current window.
Wait Waits for a button to be depressed within the currently selected window. If a button is already pressed, returns immediately.
NOTE: Not all graphics devices have interactive cursors.
Thus, for a three-button mouse, !Err will contain the values 1 - 7, depending upon which button or combination of buttons was pushed. For example, the left button produces a value of 1, the middle button 2, and the right button 4, while pressing the left and right buttons together produce the value 5.
The system variable !Mouse contains the X and Y position of the mouse, the mouse button status, and a date/time stamp. The mouse position is given in device coordinates. The button status appears as 1 - 7; these values are contained in the !Err system variable. The date/time stamp may not be available on all systems.
Since the values returned are, by default, in data coordinates, if no data coordinate system has been previously established, then calling CURSOR without specifying either the Normal or Device keywords will result in an error and procedural execution will be halted.
WINDOW, XSize=512, YSize=512 CURSOR, x, y, /Normal
PRO sketch false = 0 true = 1 window, 0 XYOUTS, 2, 2, "QUIT", Size = 2, /Device
PLOTS, [0, 48, 48], [20, 20, 0], /Device first = true REPEAT BEGIN
CURSOR, xnew, ynew, /Device
xnew
, and
; the y-coordinate in ynew
.
IF (xnew LE 48) AND (ynew LE 20) THEN STOP
IF first THEN BEGIN
xold = xnew
yold = ynew
first = false
ENDIF
xold
and yold
to be the same
; as xnew
and ynew
.
PLOTS, [xold, xnew], [yold, ynew], /Device
xold
, yold
) to (xnew
, ynew
).
xold = xnew
yold = ynew
ENDREP UNTIL FALSE END