The CURSOR procedure is used to read the position of the interactive graphics cursor from the current graphics device. Note that not all graphics devices have interactive cursors. CURSOR enables the graphic cursor on the device and optionally waits for the operator to position it. On devices that have a mouse, CURSOR normally waits until a mouse button is pressed (or already down). If no mouse buttons are present, CURSOR waits for a key on the keyboard to be pressed.
The system variable
Note that the CURSOR procedure is only for use with IDL graphics windows. It should not be used with draw widgets. To obtain the cursor position and button state information from a draw widget, examine the X, Y, PRESS, and RELEASE fields in the structures returned by the draw widget in response to cursor events.
Note that for the CURSOR procedure to work properly with Tektronix terminals, you may need to execute the command, DEVICE, GIN_CHARS=6.
CURSOR, X, Y [, Wait | [, /CHANGE | , /DOWN | , /NOWAIT | , /UP | , /WAIT]] [, /DATA | , /DEVICE, | , /NORMAL]
A named variable to receive the cursor's current column position.
A named variable to receive the cursor's current row position.
An integer that specifies the conditions under which CURSOR returns. This parameter can be used interchangeably with the keyword parameters listed below that specify the type of wait. The default value is 1. The table below describes each type of wait.
Note that not all modes of waiting work with all display devices.
Set this keyword to wait for pointer movement or button transition within the currently selected window.
Set this keyword to return X and Y in data coordinates.
Set this keyword to wait for a button down transition within the currently selected window.
Set this keyword to return X and Y in device coordinates.
Set this keyword to return X and Y in normalized coordinates.
Set this keyword to read 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.
Set this keyword to wait for a button up transition within the current window.
Set this keyword to wait for a button to be depressed within the currently selected window. If a button is already pressed, return immediately.
Activate the graphics cursor, select a point in the graphics window, and return the position of the cursor in device coordinates. Enter:
CURSOR, X, Y, /DEVICE
Move the cursor over the graphics window and press the mouse button. The position of the cursor in device coordinates is stored in the variables X and Y. To label the location, enter:
XYOUTS, X, Y, 'X marks the spot.', /DEVICE
Introduced: Original
RDPIX, TVCRS, CURSOR_CROSSHAIR (and other CURSOR_ keywords), WIDGET_DRAW, !MOUSE