(LASTKEY(arg))
Where arg is 0 or 1. When arg is 1, LASTKEY returns the original mapping for a key that has been remapped (the key that was pressed). When arg is 0, LASTKEY returns the current mapping (the key that was executed).
In the following example, DIALOG displays the message and the current date, which the user can edit. LASTKEY captures the last key pressed by the user, enabling the user to press [Esc] to avoid entering a date.
SET VARIABLE vdate TEXT
SET VARIABLE vdate = (CTXT(.#DATE))
DIALOG 'Enter the invoice date to print:' vdate vendkey 1
SET VARIABLE vlast = (LASTKEY(0))
IF vlast = '[Esc]' THEN
GOTO skipprnt
ENDIF