Home

Keyboard Interaction

AppGraphics provides limited support of keyboard interaction. The two main functions, described below, provide information on whether a key has been pressed and, if so, which key was pressed. Functions that normally return an ASCII code based on keypress will also return the following constants for non-alphanumeric keys (after first returning a zero as an indicator of a special key):

Key Constants
KEY_HOME
KEY_UP
KEY_PGUP
KEY_LEFT
KEY_CENTER
KEY_RIGHT
KEY_END
KEY_DOWN
KEY_PGDN
KEY_INSERT
KEY_DELETE
KEY_F1
KEY_F2
KEY_F3
KEY_F4
KEY_F5
KEY_F6
KEY_F7
KEY_F8
KEY_F9
KEY_F10
KEY_F11
KEY_F12

getch

C int getch ( )
Fortran function getch ( )

Description

Waits for and returns a keypress. This function normally returns an ASCII code for the key pressed. However, if a special key is pressed, the function will first return zero. The next call will return the code for the special key, as described above.

Return Value

C int
Fortran integer

The ASCII code for the key pressed, a zero, or, if the previous call was zero, a code for the special key pressed.

kbhit

C int kbhit ( )
Fortran function kbhit ( )

Description

Returns whether a key has been pressed since the last call to getch.

Return Value

C int
Fortran logical

Returns non-zero or .TRUE. if a keypress has occurred, zero or .FALSE. otherwise.