LASTKEY
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 23 APR 1992 | 2.1X | INTERMEDIATE | LASTKEY, INPUT.CHAR, KEYSTROKES, REDEFINING |
Sometimes you want to know what keystroke was used to leave a process. For example, if your program calls a collector window, it may be helpful to know whether [Esc] or [F9] was pressed to exit the window.
The LASTKEY function, provided with Advanced Revelation 2.12, lets you find out what keystroke was last returned by INPUT.CHAR.
LASTKEY returns the last key returned by INPUT.CHAR. It does not return the last key processed by INPUT.CHAR. It cannot be used to find out if any of the priority interrupt keys were used. For example, LASTKEY will not tell you that [F5] was pressed to bring up TCL. Technical Bulletin #59, "Redefining Keys in Advanced Revelation" has additional information about priority interrupt keys.
Figure 1 shows how LASTKEY can be used in a program.
Compatibility
There is a labelled common area in the INCLUDE file that also stores the last key returned by INPUT.CHAR. To maintain compatibility with future releases of Advanced Revelation, you should not use this labelled common. For future compatibility always use LASTKEY.
Examples
Figure 1
$INSERT INCLUDE, EDIT.KEYS DECLARE FUNCTION LASTKEY DECLARE SUBROUTINE CATALYST CATALYST("W", "MY_COLLECTOR") BEGIN CASE CASE LASTKEY() = SAVE.KEY MSG("The save key was pressed.") CASE LASTKEY() = QUIT MSG("The cancel key was pressed.") END CASE