To meet your needs, we constantly work to improve Querix products.
This means that Lycia documentation is developing as well.
In case you have found a certain dissonance between the provided information and the actual behavior of Lycia 3 and/or your applications, please, let us know about this via documentation@querix.com so that we can introduce the necessary changes to our documentation.
Thank you for your attention and cooperation.
Element |
Description |
Field List |
A list of one or more form fields separated by commas |
Key List |
A list that consists of one to four key names separated by commas |
The ON KEY clauses can be included into the INPUT statement to specify the behavior of the keys pressed while the input is performed. The keys can be assigned to form widgets and the actions will be triggered when such widget is pressed. However, if a key combination is not assigned to any widget, it can be activated with the help of the keyboard. One INPUT statement can contain any number of the ON KEY clauses, they can be placed in any order.
Infield Option
The ON KEY clause of the INPUT and INPUT ARRAY statements can include an optional infield() operator. This operator specifies a field or a list of fields for which the ON KEY clause will be triggered, if the key referenced by it is pressed. If the key referenced by the ON KEY clause is pressed, and the cursor is located in one of the fields specified in the infield() operator, the statements contained in such ON KEY clause will be executed. However, if the cursor is not located in any of the fields specified in the field list of the infield() operator, the ON KEY clause will be ignored, even if the corresponding key is pressed.
If the infield() operator is omitted, the ON KEY clause will be triggered when the referenced key is pressed regardless of the cursor position. If one and the same INPUT statement has two ON KEY clauses referencing the same key, but one of them has the optional infield() operator, the ON KEY... INFIELD() will be executed when the cursor is in one of the referenced field and the specified key is pressed, in all other cases the ON KEY clause without the infield() operator will be executed.
In the example below the global ON KEY event will be triggered, if the cursor is positioned in field f1 or f4 at the moment when F5 is pressed. Otherwise, the field specific event will be triggered and the global event will be ignored.
INPUT BY NAME f1,f2,f3,f4
ON KEY(F5)
CALL fgl_message_box("Global ON KEY event")
ON KEY(F5) INFIELD(F2,F3)
CALL fgl_message_box("ON KEY event for fields f2 and f3")
END INPUT
ON KEY clause can use one or several of the following keys separated by commas enclosed in parentheses to specify the key to which the other statements in the ON KEY clause refer:
ESC/ESCAPE |
ACCEPT |
NEXT/ NEXTPAGE |
PREVIOUS/PREVPAGE |
INSERT |
DELETE |
RETURN |
TAB |
INTERRUPT |
HELP |
LEFT |
RIGHT |
UP |
DOWN |
F1 – F256 |
CONTROL-char |
Any character can be used as char in the combination CONTROL-char except the following characters: A, D, H, I, J, K, L, M, R, and X. The key names can be entered either in lower case or in upper case letters.
Any 4GL or SQL statements can be used in the ON KEY clause, it can also include EXIT INPUT, CONTINUE INPUT and NEXT FIELD keywords. These statements are executed when the key specified in the corresponding ON KEY clause is pressed.
When the user presses a key and the corresponding ON KEY clause within the INPUT statement is activated, the following actions are performed:
The input is suspended
The characters entered into the current field before the key has been pressed are stored in the input buffer
The statements that belong to the corresponding ON KEY clause are executed
The characters saved in the buffer are restored to the field
The input is resumed, the cursor is placed at the end of the character string retrieved from the buffer
The default behaviour of the ON KEY clause can be changed, if you add the NEXT FIELD in this clause, which will specify the field where the input should be resumed.
The contents of the input buffer can be changed by assigning a new value to the variable by means of the statements in an ON KEY clause. To support specific field actions use the infield() operator in this clause.
INPUT var1, var2, var3 FROM f001, f002, f003
ON KEY (CONTROL-R, F14)
CALL client_info()
ON KEY (CONTROL-P)
IF var1 IS NOT NULL AND var2 IS NOT NULL THEN
CALL insert_data()
END IF
Some keys require special attention if used in the ON KEY clause:
Key |
Usage Features |
ESC/ESCAPE |
If you want to use this key in ON KEY clause, 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 in order that this key could be used in the ON KEY clause. On pressing the INTERRUPT key the corresponding ON KEY clause is executed, int_flag is set to non-zero but theCONSTRUCT statement is not terminated |
QUIT |
DEFER QUIT statement must be executed in order that this key could be used in the ON KEY clause. On pressing the QUIT key the corresponding ON KEY block is executed and int_flag is set to non-zero |
CTRL-char (A, D, H, L, R, X) |
4GL reserves these keys for field editing and they should not be used in the ON KEY clause |
CTRL-char (I, J, M) |
These key combinations by default mean TAB, NEWLINE and RETURN. If they are used in the ON KEY clause, they cannot perform their default functions while the OK KEY block is functional. Thus, if you use these keys in the ON KEY clause, the period of time during which this clause is functional should be restricted. |
Some restrictions in key usage might be applied depending on your operational system. Many systems use such key combinations as CONTROL-C, CONTROL-Q, and CONTROL-S for the Interrupt, XON, and XOFF signals.
If the default Accept and Help keys are redefined with the help of the OPTIONS statement, the new Accept and Help keys cannot be used in the ON KEY clauses. If you define the F1 key to be the help key, you cannot use the F1 key in an ON KEY clause.
OPTIONS HELP KEY (F1)
After all the statements within the ON KEY block have been executed, the form is reactivated, the cursor is in the same field where it has been before the key specified in an ON KEY block has been pressed, unless the ON KEY clause contains the EXIT INPUT or the NEXT FIELD keywords.