CmdKey
The CMDKEY internal function returns a value from 1 to 20 to identify the last command key (function key) used to terminate keyboard input, or returns 0 if <ENTER> was the last key pressed. At the start of the program, CMDKEY is initialized to -1.
See also FKey - a newer more powerful version of CMDKEY.
The CMDKEY function now accepts a value. This is useful for KSTAT$ processing and for setting expected CMDKEY inputs without operator intervention. In the following sample syntax, CMDKEY is assigned the value of x:
00010 LET CMDKEY(x)
CMDKEY now returns values of 90 and 91 for the PgUp and PgDn keys during program input. See "PgUp and PgDn" in the Keys section for more information.
Comments and Examples
09000 PRINT NEWPAGE 09010 PRINT "The record you tried to read is" 09020 PRINT "in use at another workstation." 09030 PRINT "*** Press F9 to try again, or" 09040 PRINT "*** <CR> to select another record" 09050 LINPUT DUMMY$ 09060 IF CMDKEY = 9 THEN RETRY 09070 GOTO START
Line 9060 tests for the operator pressing the F9 key in response to the locked record message presented in the text above.
For other examples, see CURFLD
Technical Considerations
- INPUT, LINPUT or RINPUT statements using the keyboard as input, or any INPUT FIELDS or INPUT SELECT statement will set the CmdKey variable.
- The Shift-F1 through Shift-F10 key combinations set CmdKey the values from 11 to 20. Some keyboards include separate F11 and F12 keys, but these will not set the CmdKey variable.