User`s guide

The arguments to the KEYMODE instruction indicate that pendant buttons 1 through 5 are to
be configured in keyboard mode. The 0 argument to the PENDANT() function indicates that
the button number of the first keyboard button pressed is to be returned.
Toggle Mode
To detect the state of a button in toggle mode, the PENDANT() function must specify the
button to be monitored.
When a button is configured as a toggle button, its state is maintained as on (-1) or off (0).
The state is toggled each time the button is pressed. If an LED is associated with the button,
it is also toggled. The following code sets the REC/DONE button to toggle mode and waits until
REC/DONE is pressed:
; Set the REC/DONE button to toggle
KEYMODE 8 = 1
; Wait until the REC/DONE button is pressed
DO
WAIT
UNTIL PENDANT(8)
The arguments to KEYMODE indicate that MCP button number 8 (the REC/DONE button) is
configured as a toggle button. The argument to PENDANT() indicates that the state of MCP
button 8 is to be read.
Level Mode
To detect the state of a button in level mode, the PENDANT() function must specify the
button to be monitored.
When a button has been configured as a level button, the state of the button is on as long as
the button is pressed. When the button is not pressed, its state is off. The following code uses
the buttons labeled 2, 4, 6, and 8 (button numbers 45, 47, 49, and 57-don't confuse the
button labels with the numbers returned by the PENDANT function) to move the cursor
around the terminal display. The buttons are configured as level buttons so the cursor moves
as long as a button is depressed.
; Set the REC/DONE button to toggle
KEYMODE 8 = 1
; Set the data entry buttons labeled "2" - "8" to level
KEYMODE 45, 51 = 2
DO
IF PENDANT(49) THEN
TYPE /X1, /S ;Cursor right
END
IF PENDANT(47) THEN
TYPE $CHR(8) ;Cursor left (backspace)
END
IF PENDANT(51) THEN
TYPE /U1, /S ;Cursor up
END
Detecting User Input
V+Language User's Guide, v17.0
Page 270