HP Data Entry and Forms Management System (VPLUS) Reference Manual (32209-90024)

Appendix E 589
Application Hints
Coding the Touch Feature
Coding the Touch Feature
In order to use the touch feature effectively, a method is needed to provide feedback to the
user when a field is touched. Changing the field enhancement is one of the best methods to
indicate that a field has been touched. The enhancement of a field can be changed by using
the VCHANGEFIELD intrinsic, or family forms. If neither of these methods is appropriate and
the error count is not important, VSETERROR can be used instead. VSETERROR toggles the
error flag when called successively; i.e., if VSETERROR is called the second time for a
particular field, the error flag is cleared. Therefore, the error enhancement can be used
with VSHOWFORM as feedback to the user to indicate that a field has been touched. This
feature is only activated if the showcontrol bit 0 is set to 1.
When designing touch applications, the designer should keep the idea of compatibility in
mind. Applications should be able to run on HP 262X/239X terminals, or on a touch
terminal/workstation using keyboard input. For VPLUS applications, this objective can be
achieved by designing one single form interface for all HP 262X/239X terminals.
To design a touch application with compatibility in mind, the interface should be built so
that the user has the option of responding via the keyboard or the touch screen. This
consideration is important in two respects. First, it provides an alternative path for the
user when an application is run on touch terminals. Second, an application can be run on
non-touch terminals as well as touch terminals.
For example, if an application is designed to display a form with many items for the user to
select from, the programmer may wish to include one input field for the users to type in
their choice. This will allow for one interface for both touch and non-touch terminals.
Example
IF COM-LASTKEY < 0 THEN
CALL "VSHOWFORM" USING COMAREA
CALL "VREADFIELDS" USING COMAREA
IF COM-LASTKEY IS NOT EQUAL TO -999 THEN
NEXT-FIELD = -(COM-LASTKEY)
CALL "VSETERROR" USING COMAREA, NEXT-FIELD, MSG, MSGLEN
CALL "VSETERROR" USING COMAREA, PREVIOUS-FIELD, MSG, MSGL
EN
PREVIOUS-FIELD = NEXTFIELD.
The first VSETERROR toggles the error flag of the new field touched, and the second
VSETERROR toggles the error flag of the previous field touched. When VSHOWFORM is called,
NEXT-FIELD will be highlighted with the error enhancement, while PREVIOUS-FIELD
reverts to the normal enhancement. The VPLACECURSOR intrinsic can be used to position
the cursor if the default cursor position set by VSETERROR needs to be overridden. @