Navigation: Language Reference > 13 - Built-in Functions >====== ALERT (set event generation key) ====== | |
ALERT([first-keycode] [,last-keycode])
ALERT | Specifies keys that generate an event. |
first-keycode | A numeric keycode or keycode equate label. This may be the lower limit in a range of keycodes. |
last-keycode | The upper limit keycode, or keycode equate label, in a range of keycodes. |
ALERT specifies a key, or an inclusive range of keys, as event generation keys for the currently active window. The ALERT statement with no parameters clears all ALERT keys. The current list of key codes can be found in the KEYCODES.CLW source file.
Two field-independent events, EVENT:PreAlertKey and EVENT:AlertKey, generate when the user presses the ALERTed key (in that order). If the code does not execute a CYCLE statement when processing EVENT:PreAlertKey, you “shortstop” the library's default action on the alerted keypress. If the code does execute CYCLE when processing EVENT:PreAlertKey, the library performs its default action for the alerted keypress. In either case, EVENT:AlertKey generates following EVENT:PreAlertKey.
Any key with a keycode may be used as the parameter of an ALERT statement. ALERT generates field-independent events, since it is not associated with any particular control. When EVENT:AlertKey is generated by an ALERT key, the USE variable of the control that currently has input focus is not automatically updated (use UPDATE if this is required).
The ALERT statement alerts its keys separately from the ALRT attribute of a window or control. This means that clearing all ALERT keys has no effect on any keys alerted by ALRT attributes.
Example:
Screen WINDOW,ALRT(F10Key),ALRT(F9Key) !F10 and F9 alerted
LIST,AT(109,48,50,50),USE(?List),FROM(Que),IMM
BUTTON('&Ok'),AT(111,108,,),USE(?Ok)
BUTTON('&Cancel'),AT(111,130,,),USE(?Cancel)
END
CODE
OPEN(Screen)
ALERT !Turn off all alerted keys
ALERT(F1Key,F12Key) !Alert all function keys
ALERT(279) !Alert the Ctrl-Esc key
ACCEPT
CASE EVENT()
OF EVENT:PreAlertKey !Pre-check alert events
IF KEYCODE() <;> F4Key !Dis-Allow F4 key standard library action, and allow
CYCLE !all other F keys to perform their standard functions
END
OF EVENT:AlertKey !Alert processing
CASE KEYCODE()
OF 279 !Check for Ctrl+Esc
BREAK
OF F9Key !Check for F9
F9HotKeyProc !Call hot key procedure
OF F10Key !Check for F10
F10HotKeyProc !Call hot key procedure
END
END
END
See Also: