LASTKEY function
Returns, as an INTEGER value, the integer key code of the most recent event read from the user (that is, from the keyboard or mouse) during an interaction with a procedure.
Note: Does not apply to SpeedScript programming.Syntax
ExampleIn this procedure, the user can move through the Customer file and update certain fields in each of the Customer records. The GO-ON option tells the procedure to continue on to the following statements if the user presses F9, F10, or F12. To determine what action to take, the LASTKEY function compares the key code of the last key pressed with the key codes F9, F10, and F12.
Notes
- The LASTKEY function is double-byte enabled. The LASTKEY function returns values only after the input method places the data in the keyboard buffer. It returns the key code of the most recent key sequence returned from the keyboard buffer. A key sequence is the set of keystrokes necessary to generate one character or function key event in ABL.
- If you used a READKEY statement that timed out (you specified a number of seconds by using the PAUSE option with the READKEY statement), or if a PAUSE statement times out, the value of LASTKEY is -1.
- If you use the PAUSE option with the READKEY statement, the value of LASTKEY is the key you press to end the PAUSE.
- When the ABL session starts, the value of LASTKEY is -1. This value remains the same until the first input, READKEY, or procedure pause occurs. The LASTKEY function is reset to -1 each time you return to the Procedure Editor.
- If you read data from a file, LASTKEY is set to the last character read from the file. For an INSERT, PROMPT-FOR, SET or UPDATE statement, this is always KEYCODE(“RETURN”). For a READKEY statement, this is the character read from the file. If you reach past the end of the file, LASTKEY is -2.
- For more information on keys, see OpenEdge Development: Programming Interfaces.
See also
OpenEdge Release 10.2B
|