Difference between revisions of "ON KEY"
Yvonnemilne (Talk | contribs) |
Helengeorge (Talk | contribs) (→Class) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
Revision as of 14:42, 23 October 2009
Contents
Purpose
Trap a specified key or any key pressed
Syntax
ON KEY [= <expN> | LABEL <keyname>] [<command>]
See Also
SET KEY, SET KEY TO, SET PCFKEYS, SET PCKEYS, SET TYPEAHEAD
Description
The ON KEY command causes the specified <command> to be executed if a key is pressed. The numeric expression = <expN> uses keycodes to specify which key to trap. The LABEL qualifier uses keynames to specify which key to trap. A specific key that is set to be trapped with the ON KEY command is known as a 'hot key'. When a hot key is pressed from a read or wait state, the specified Recital/4GL <command> is executed. SET PCKEYS must be ON so that the specified keycode is translated to the correct keypad or function key.
<command>
The ON KEY command traps any key, in other words, the next pressed key, when no keycodes or keynames are specified with the command. If ON KEY is specified without a <command>, then no keys will be trapped. The <command> can be any Recital/4GL command.
= <expN>
The optional = <expN> allows a command to be assigned to a particular hot key using keycodes. The following table illustrates the keycode choices and the keys they represent.
Keypad Key | PC Key | Keycode |
---|---|---|
[1] | F1 | 315 |
[2] | F2 | 316 |
[3] | F3 | 317 |
[4] | F4 | 318 |
[5] | F5 | 319 |
[6] | F6 | 320 |
[7] | F7 | 321 |
[8] | F8 | 322 |
[9] | F9 | 323 |
[0] | F10 | 324 |
[CURSOR LEFT] | CURSOR LEFT | 331 |
[CURSOR RIGHT] | CURSOR RIGHT | 333 |
[CURSOR UP] | CURSOR UP | 328 |
[CURSOR DOWN] | CURSOR DOWN | 336 |
[PAGE UP] | PgUp | 329 |
[PAGE DOWN] | PgDn | 337 |
LABEL
The optional LABEL qualifier uses keynames to specify which key to trap. The keynames may be typed in upper, lower, or mixed case. SET PCFKEYS must be ON to enable the use of CTRL-<letter> keynames. The following table illustrates the keynames that may be used with the LABEL qualifier:
Key | Keyname |
---|---|
F1 to F10 | F1, F2, F3 … |
CURSOR LEFT | Leftarrow |
CURSOR RIGHT | Rightarrow |
CURSOR UP | Uparrow |
CURSOR DOWN | Downarrow |
PAGE UP | PgUp |
PAGE DOWN | PgDn |
DELETE | Del |
INSERT | Ins |
TAB | Tab |
CTRL A TO CTRL Z | Ctrl-A, Ctrl-B, Ctrl-C |
Example
// Run mail procedure mail_procedure save screen clear run mail clear restore screen return // Define F10 for mail hot key set pckeys on on key = 324 do mail_procedure // Define F10 another way set pckeys on on key label F10 do mail_procedure // Or use Ctrl key set pckeys on set pcfkeys on on key label Ctrl-L do mail_procedure
Products
Recital Mirage Server, Recital Terminal Developer