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.
OPEN FORM statement declares a form-name of a compiled 4GL screen form so that it could be referenced by the DISPLAY FORM statement.
Element |
Description |
Form Name ↓ |
The name you want to assign to the opened form |
Form File ↓ |
A 4GL expression that returns the name of the form file and its relative path, if required |
To display a screen form, follow these steps:
Create a screen form (in the .per format or in the .4fm format) and compile it.
Declare the name of the form by means of the OPEN FORM statement
Display the declared form with the help of the DISPLAY FORM statement
The displayed form can be activated by means of the CONSTRUCT, DISPLAY ARRAY, INPUT, or INPUT ARRAY statement. When the OPEN FORM statement is executed, the form file is loaded into memory.
Form name that follows the OPEN FORM keywords can be represented by a character string, it need not to be declared previously. The form-name does not need to match the name of the form file. However, it should be unique among the other forms used by the program. The form-name can be referenced in any part of the program once it has been declared by means of the OPEN FORM statement.
The file-name of the form must follow the FROM keywords. It must specify the name of the file without the extension, but with the relative path, if it is required. The file-name should be enclosed into the quotation marks. The path is required for form files located not in the same folder as the file which contains the corresponding OPEN FORM statement.
OPEN FORM my_form FROM "/forms/form_file1"
Form files can be specified in the following ways:
A quoted string that contains the name of the file and its relative path if necessary
A variable of character data type (CHAR, VARCHAR, or STRING), a record member or array element of the character data type that returns the name and path of a form file
Any 4GL expression that returns the name and the path of a form file
The name of the form file must not include the file extension. Below is an example of a 4GL expression used after the FROM keyword:
DEFINE
f_file STRING,
id_number SMALLINT
LET id_number = 12
LET f_file = "file00"||id_number
OPEN FORM my_f FROM f_file
The form file opened in the example above must be called file0012.
There are two ways of displaying a screen form in a 4GL window:
Place the OPEN FORM and DISPLAY FORM statements after the OPEN WINDOW statement
MAIN
OPEN WINDOW window1 AT 2,2 WITH 15 ROWS, 50 COLUMNS
ATTRIBUTE (BORDER)
OPEN FORM my_form FROM "forms/form_file1"
DISPLAY FORM my_form
…
END MAIN
If the size of the form displayed by the DISPLAY FORM statement is larger than the window in which it is displayed, a runtime error -1142 will occur, informing you that the window is too small to display the form
Use the OPEN WINDOW … WITH FORM statement
OPEN WINDOW window2 AT 2, 2 WITH FORM "form_file1"
When a form is displayed by means of the OPEN WINDOW … WITH FORM statement, the window will be the same size as the form, so you cannot receive error -1142.
If you use the same form-name in another OPEN FORM statement, the previously opened form will be closed and 4GL will open a new one.
If you open a screen form in a 4GL window, you do not need to use the statement CLOSE FORM to release the memory allocated to the form. The form will be closed and the memory will be released when the corresponding 4GL window is closed by means of the CLOSE WINDOW statement.