Reads values from any of the AutoCAD input devices
(grread [track] [allkeys [curtype]])
Only specialized AutoLISP routines need this function. Most input to AutoLISP should be obtained through the various getxxx functions.
- track
- allkeys
-
An integer representing a code that tells grread what functions to perform. The allkeys bit code values can be added together for combined functionality. The following values can be specified:
1 (bit 0) Return drag mode coordinates. If this bit is set and the user moves the pointing device instead of selecting a button or pressing a key, grread returns a list where the first member is a type 5 and the second member is the (X,Y) coordinates of the current pointing device (mouse or digitizer) location. This is how AutoCAD implements dragging.
2 (bit 1) Return all key values, including function and cursor key codes, and don't move the cursor when the user presses a cursor key.
4 (bit 2) Use the value passed in the curtype argument to control the cursor display.
8 (bit 3) Don't display the error: console break message when the user presses ESC.
- curtype
-
An integer indicating the type of cursor to be displayed. The allkeys value for bit 2 must be set for the curtype values to take effect. The curtype argument affects only the cursor type during the current grread function call. You can specify one of the following values for curtype:
0 Display the normal crosshairs.
The grread function returns a list whose first element is a code specifying the type of input. The second element of the list is either an integer or a point, depending on the type of input. The return values are listed in the following table:
Handling User Input with grread
Entering ESC while a grread is active aborts the AutoLISP program with a keyboard break (unless the allkeys argument has disallowed this). Any other input is passed directly to grread, giving the application complete control over the input devices.
If the user presses the pointer button within a screen menu or pull-down menu box, grread returns a type 6 or type 11 code, but in a subsequent call, it does not return a type 12 code: the type 12 code follows type 6 or type 11 only when the pointer button is pressed while it is in the drawing area.
It is important to clear the code 12 data from the buffer before attempting another operation with a pointer button or an auxiliary button. To accomplish this, perform a nested grread like this:
(setq code_12 (grread (setq code (grread))))
This sequence captures the value of the code 12 list as streaming input from the device.