KEY clause

KEY clause contains from one to four keys that activate the corresponding menu option. If the KEY clause is absent, the first character of the option name is the activation key for the menu option. If the KEY clause is present, the first letter of the option name cannot be used as the activation key. It is advisable that you use unique option names that begin with different letters, if you do not plan to specify the KEY clauses for them.

 

If the activation key is pressed, 4GL executed the statements contained in the COMMAND clause of the option. After it has executed the last statement of the clause, the menu is redisplayed, unless the COMMAND clause contains the EXIT MENU or EXIT PROGRAM keywords.

 

In the example below the first menu option is activated with the help of the CONTROL-P key, specified in the KEY clause, the second one is activated with the help of the F key – the initial letter of the option name, because the KEY clause is absent:

MENU "Main"

COMMAND KEY (CONTROL-P) "Add" "Add a new record"

COMMAND "Find" "Search for a record"

END MENU

 

These keys can be specified in a KEY clause:

 

Some keys require special attention if used in the ON KEY clause:

ESC/ESCAPE

If you want to use this key in ON KEY block, you must specify another key as the Accept key in the OPTIONS block, because ESCAPE is the Accept key by default.

INTERRUPT

DEFER INTERRUPT statement must be executed before you will be able to use this key in the KEY block. On pressing the Interrupt key, the corresponding COMMAND clause is executed, int_flag is set to non-zero but the MENU statement is not terminated.

QUIT

DEFER QUIT statement must be executed before you will be able to use this key in the KEY block. On pressing the Quit key the corresponding COMMAND clause is executed and int_flag is set to non-zero but the MENU statement is not terminated

CTRL-char

(A, D, H, K, L, R, X)

4GL reserves these keys for field editing and they should not be used in the KEY block.

CTRL-char

(I, J, M)

These key combinations by default mean TAB, NEWLINE and RETURN. If they are used in the KEY block, they cannot perform their default functions while the KEY block is functional.

You may not be able to use the keys S, Q and Z in a KEY clause on some versions of UNIX OS. You may not be allowed to use other keys which may be reserved by your operational system.

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.