sds_grread

int sds_grread (int bits, int *answertype, struct sds_resbuf *answer);


Read data from any input device.


This function directly reads the data generated by input devices. A note of caution applies when using this function: the data can become an overwhelming amount.

The argument bits specifies the following:

Track 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 table 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.
Pulldown menu 4 1,001 to 1,999 POP1 menu
2,001 to 2,999 POP2 menu
16,001 to 16,999 POP16 menu
Mouse (other pointer) 5 3-dimensional point.

The argument answer the actual input, including type and value, is stored in this result buffer.

This function returns RTNORM or RTCAN.

Example

int type;

sds_resbuf readinput;

sds_grread(2,&type,&readinput); // Using 2 returns the value of any key pressed.

switch(type){

case 2: sds_printf("\nYou used the keyboard."); break;

case 3: sds_printf("\nYou selected a point."); break;

etc.

break;

}

switch(readinput.restype){

case RTREAL: sds_printf("\nIts value is %f. ",readinput.resval.rreal)

break;

case RTPOINT: sds_printf("\nThe 2D point is %f,%f.",

readinput.resval.rpoint[X],readinput.resval.rpoint[Y]);

break;

etc.

}     

Tell me about...

Programming Overview of SDS™ (Solutions Development System™)