(grread [flag] [bits [cursor]])


Read the data coming in from the input devices.


This function is another method to get user input. It reads successive input via input method. The flag option lets you obtain the user's coordinates. When flag is non-nil, it follows the movements of the mouse or pointer and records the coordinates dynamically, which can generate a great amount of data.

The optional bits argument specifies the following:

Bits Meaning
1 Returns the coordinates dynamically in the form of a list. The list consists of the value and the 3-D coordinate.
2 Returns keystrokes but does not move the cursor. Returns all key values, including cursor and function key codes.
4 Turn this on if you are going to choose a cursor type.
8 Turns off the error message "console break" when you cancel out of the loop.

Add the bits above to obtain a combination if desired.

The cursor argument is an integer that corresponds to a cursor type:

Cursor Meaning
0 Normal cursor-crosshairs.
1 No cursor.
2 Selection cursor-box.

The following chart describes how the information is returned. For example, if you entered the letter, l (keyboard input), the value 2 and the character code would be returned (2 108) in a list.

Type of Input Returned Value (Definition)
Keyboard 2 (Character code)
Selected Point 3 (3-dimensional point)
Mouse (other pointer) 5 (3-dimensional point)

Example

(defun c:b ()

(while (print (grread 1 5 2)))

)

Explanation

In the above example, when you move the mouse, a list displays similar to (5 (2.3659 9.2846 0.0)), where the 5 represents the type of input (mouse) and where the coordinates are the exact coordinates of the mouse location. This changes dynamically as you move the mouse. When you select a point, a possible return would be (3 (2.3659 9.2846 0.0)), where 3 designates the type of input (selected point). When you entered a letter, let's say p, your return would be (2 112), where 2 denotes keyboard input, and 112 stands for the character code.

Tell me about...

(getint [prompt])

(getpoint [point] [prompt])

(getreal [prompt])

(getstring [flag] [prompt])

LISP Compatibility

Programming Overview of LISP (LISt Processing) Language