ON KBD defines an event branch to be taken when a key is pressed. ON KBD ALL traps all alpha-numeric keys and HTBasic function keys except RESET. The following keys are not trapped if ALL is not specified: CLR I/O, MENU, PAUSE, s-MENU, STOP, EXECUTE, USER and any softkeys.
If ON KBD is active, immediate execution of keyboard editing and display control function keys is suspended. All keystrokes go into a special KBD$ buffer. The buffer is cleared when it is read. The event handling routine can selectively execute keys found in KBD$ by including them in an OUTPUTKBD statement:
OUTPUT KBD;Buf$;
Unless an ON KNOB definition is active, movement of the mouse generates ON KBD interrupts and places UP, DOWN, LEFT or RIGHT keystrokes into the KBD$ buffer. If both ON KBD ALL and ON KEY are active, ON KBD ALL takes precedence over ON KEY.
Executing a new ON KBD while another ON KBD is still in effect overrides the previous ON KBD definition. If the ON KBD is executed in a different program context, the original ON KBD definition is restored when control returns to the calling context.