User`s guide

Detecting User Input
Input from the pendant can be received in two ways:
l A series of button presses from the data entry buttons can be read. The READ
instruction is used for this type of input.
l A single button press from any of the buttons can be detected. These single button
presses can be monitored in three different modes:
l The buttons can be monitored like keys on a normal keyboard.
l The buttons can be monitored in toggle mode (on or off). The state of the
button is changed each time the button is pressed.
l The keys can be monitored in level mode. The state of the button is considered
"on" only when the button is held down.
The PENDANT() function is used to detect button presses in these modes. The KEYMODE
instruction is used to set the button behavior.
Using READ With the Pendant
The READ instruction accepts input from the pendant Data Entry Buttons (1, 2, 3, 4, 5, 6, 7,
8, 9, 0, ., +, -). A READ instruction expects a <CR-LF> to indicate the end of data entry. On
the MCP, this sequence is sent by the REC/DONE button (similar to the Enter or Return key
on a normal keyboard). The DEL button behaves like the Backspace key on a normal
keyboard. All other pendant buttons are ignored by the READ instruction. Note that the
predefined function buttons are active and may be used while an attached program is
waiting for input.
The instruction line:
READ(1) $response
pauses the program and wait for input from the pendant. The user must signal the end of
input by pressing the REC/DONE button. The input is stored in the string variable $response.
The input can be stored as a real variable, but the + and - buttons must not be used for
input.
Detecting Pendant Button Presses
Individual MCP button presses are detected with the PENDANT() function. This function
returns the number of the first acceptable button press. See the following figure for the
numbers of the buttons on the MCP. The interpretation of a button press is determined by
the KEYMODE instruction. See the V+ Language Reference Guide for complete details. The
basic use of these two operations is described below.
Detecting User Input
(Undefined variable: Primary.Product_Name_V)Language User's Guide, version
17.x
Page 267