Built-in functions / Built-in functions |
Returns the key code corresponding to the logical key that the user most recently typed in the form.
FGL_LASTKEY() RETURNING result INTEGER
The FGL_LASTKEY() function returns a numeric code corresponding to the user's last keystroke before the function was called. For example, if the last key that the user pressed was a lowercase s, the function returns the code 115 (i.e. the ASCII character set code).
The value of FGL_LASTKEY() is undefined in a MENU statement.
The function returns NULL if no key has been pressed.
It is not required to know the specific key codes returned by FGL_LASTKEY(): The FGL_KEYVAL() function can be used to compare the key code of the last key pressed. The FGL_KEYVAL() function lets you compare the last key pressed with a logical of physical key. For example, you do not need to know the physical key defined to validate a dialog, you can use the logical name "accept" instead. For a complete list of key codes and logical key names, see the Key code table.
Pay attention to the fact that this function is provided for backward compatibility. The abstract user interface protocol is based on logical events, not only key events. For example, in GUI mode, when selecting a new row with the mouse in a table, there is no key press as when moving in a static screen array in TUI mode. However, the runtime system tries to emulate as much as possible keystrokes from non-keystroke events.