HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4- 94
subprogram
A valid subprogram name.
line_id
A line number or line label.
key_label
A quoted string of characters used to fill in the label
field of the user-definable key. The string that you
use is specific for your terminal. If the label is <=
fifteen characters, it is centered in the key label. If
the key label is missing, "f1" through "f8" are used.
priority_level
A
num_expr
between 1 and 15, inclusive, used to
determine the order in which multiple branches specified
by interrupts and branch-during-input statements are
handled. If this option is not selected, the branch is
placed on the interrupt queue with a priority of 1.
Examples
100 ON KEY 1 GOTO 120
110 ON KEY 1 GOTO Help_label
120 ON KEY 3 CALL Help
130 ON KEY 1 CALL Help_routine,LABEL=" HELP "
140 ON KEY 1,2 GOSUB 10,LABEL=Label$
150 ON KEY 4,5 CALL Assist,PRI=4
160 ON KEY 2 CALL Help_entry,LABEL=" HELP ENTRY",PRI=10
170 ON KEY 7,8 CALL Exit_routine,LABEL=" exit",PRIORITY=15
The following example is designed to illustrate the behavior of the ON
KEY statement with regard to labels and priorities.
10 ON KEY 1 CALL Suba; LABEL = "Main"
20 PRESS KEY 1
30 PRINT "Done"
40 SUB Suba
50 ON KEY 1 GOTO Myline;PRIORITY = 4;LABEL = "Suba"
60 PRINT "In Suba"
70 PRESS KEY 1
80 SUBEXIT
90 Myline: PRINT "Myline"
100 SUBEND
Running this program produces the following output:
In Suba
Myline
Done
In line 10, KEY 1 is defined with a call action. Main is the label of
function key 1.
In line 20, KEY 1 is pressed. This causes the Suba routine in lines 40
through 100 to be executed. On line 50 KEY 1 is defined with a GOTO
action. Label "Suba" appears on function key 1. Next, the PRINT
statement in line 60 is executed. Following that, in line 70, KEY 1 is
pressed. Since the priority of KEY 1 is defined to be 4, the action
associated with the ON KEY statement is taken. Remember that KEY 1 was
given a priority of 1 on line 10 and a call action was taken. The call
action remains active unless KEY 1 is redefined with a higher priority in
the subunit. Since this is the case in the above example, line 90 is
executed. Line 100 causes a branch to line 30. The PRINT statement in
line 30 is executed and the program ends.
OPEN FORM
This statement opens a form and displays it on the terminal. There are
several options provided to control or preserve information already on
the screen.