OPEN FORM

OPEN FORM statement declares a form-name of a compiled 4GL screen form so that it could be referenced by the DISPLAY FORM statement.

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

All the file names you use in your 4gl development must be platform-independent.

If you use platform-dependent names (e.g., combine upper and lower case, use colons, finish names with a full stop, etc.), please remember that they might cause different problems when you move your project to another platform.

 

To display a screen form, follow these steps:

  1. Create a screen form (in the .per format or in the .4fm format) and compile it.

  2. Declare the name of the form by means of the OPEN FORM statement

  3. 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.

Every 4gl program must include some user interactions.

If your 4gl program doesn't have any user interactions, it will be performed at runtime and close immediately - without visible actions (like opening windows or forms, etc.) except for console displays.

Form name

Form name that follows the OPEN FORM keywords can be represented by a character string, it need not to be declared previously:

OPEN FORM my_form FROM "/forms/form_file1"

 

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.

Form file

Form files can be specified in these ways:

 

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.

Displaying forms to a 4GL window

There are two ways of displaying a screen form in a 4GL window:

 

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.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.