User`s guide

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 indicator bar (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
WHILE NOT PENDANT(8) DO
RELEASE -1
END
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 51 - 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 mode
KEYMODE 8 = 1
; Set the data-entry buttons labeled "2" - "8" to level mode
KEYMODE 45, 51 = 2
; Respond to the data-entry buttons
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
IF PENDANT(45) THEN
TYPE $CHR(12) ;Cursor down (line feed)
END
UNTIL PENDANT(8)
Level Mode
To detect the state of a button in Level mode, the PENDANT() function must specify the
button to be monitored.
Detecting User Input
V+Language User's Guide, v17.0
Page 290