HTBasic Help
×
Menu
Index

ON KEY

Defines an event branch for when a softkey is pressed.
 
 ON KEY key-number [LABEL label] [,priority] action
 
Usage:
ON KEY 1 GOTO 200
ON KEY 5 LABEL Find$ RECOVER 500
ON KEY 2 LABEL "Print",3 CALL Findings
 
Example:           ON KEY.BAS
 
Description:
ON KEY defines a softkey event branch and optionally a label to be displayed in the softkey menu. When the softkey is pressed, the event occurs. The key number must be in the range of zero through twenty-three. Only as many characters as will fit in the menu area softkey label are displayed from the label.
 
If the label begins with a CLR LN key (CHR$(255) & "#"), only the characters after the CLR LN will be displayed. If the label begins with a CONTINUE key, the two characters (CHR$(255) & "C") will be replaced with the string "CONTINUE". If the label begins with a RUN key, the two characters (CHR$(255) & "R") will be replaced with the string "RUN".
 
Executing a new ON KEY while another ON KEY for the same softkey is still in effect will override the previous LABEL and definition. If the ON KEY is executed in a different program context, the original ON KEY definition is restored when control returns to the calling context.
ON KEY is canceled by OFF KEY, disabled by DISABLE and temporarily disabled by an LINPUT, INPUT, or ENTERKBD statement. A SUBEXIT, SUBEND, or RETURN from the defining subprogram also cancels it.
 
More information about ON KEY can be found under the "Common Information" heading of the ON CYCLE manual entry.
 
See Also: