SNEXTKEY C-3

NAME

snextkey - insert a key into the input key queue

SYNOPSIS

int snextkey (ch)

int ch;

DESCRIPTION

Snextkey inserts the character specified by ch into form's input key queue. The character ch may be an ASCII character, a getkey(C-3) key value (as defined in the include file \cbase\include\cbase\escape.h) or a form function key value (as defined in \cbase\include\cbase\form.h).

The input queue holds a maximum of 32 characters. Form takes input from the input queue first, then from the keyboard.

Whenever form displays an error message, form clears the input queue. Any pending operations inserted into the input queue by snextkey are removed.

For example, the following user edit routine makes the F9 function key in UPDATE mode automatically do a STORE, FIND, and UPDATE. Note that if form cannot do one of the operations, the remaining ones are discarded.

#include <cbase/escape.h>

#include <cbase/form.h>

char *

user_edit (type, edit_name, old_value, new_value, exit_char) int type;

char *edit_name;

char *old_value;

char *new_value;

int exit_char;

{

if (type == U_FKEY && exit_char == F9

&& smode() == F_UPDATE) {

snextkey (F_STORE);

snextkey (F_FIND);

snextkey (F_UPDATE);

}

}

SEE ALSO

form(C-3), getkey(C-3)

Chapter 2,

Terminal Independent I/O

DIAGNOSTICS

If there is no room in the input queue, snextkey returns 0. If the character is successfully inserted into the input queue, snextkey returns a non-zero value.