User interface / Windows and forms in programs |
Programs manipulate window and form objects to define display areas for interactive instructions such as INPUT ARRAY, DISPLAY ARRAY, DIALOG, INPUT and CONSTRUCT. When such interactive instruction takes control, it uses the form associated with the current window. Forms are defined in .42f compiled form files and are loaded and displayed in windows.
The windows are created from programs; they define a display context for sub-elements like forms, ring menus, message and error lines. A window can contain only one form at a time.
When using a character terminal, windows are displayed as fixed-size boxes, at a given line and column position, with a given width and height. When using a graphical front end, windows are displayed as independent re-sizeable windows by default. This behavior is needed to create real graphical applications, but it breaks the old-mode layout implementations. Text or graphical display mode is controlled by the FGLGUI environment variable. To simplify migration from IBM® Informix® 4GL or Four Js BDS, you can run a GUI application in traditional mode, displaying windows as simple static areas inside a real graphical parent window. The traditional mode can be enabled with the gui.uiMode="traditional" FGLPROFILE setting.
When a program starts, it creates a default window named SCREEN. This default window can be used as another window (it can hold a Ring Menu and a Form), but it can also be closed, with CLOSE WINDOW SCREEN. You can display the main form of your program in the SCREEN window, by using OPEN FORM + DISPLAY FORM.
A program creates a new window with the OPEN WINDOW instruction, which also defines the window identifier. The program destroys a window with the CLOSE WINDOW instruction. One or more windows can be displayed concurrently, but there can be only one current window. You can use the CURRENT WINDOW instruction to make a specific window current. This is however not typical and is not recommended, since the last created window becomes the current window. When the last created window is closed, the previous window in the window stack becomes the current window.
Specify decoration options with presentation styles for the window, identified the STYLE attribute of the ATTRIBUTES section of OPEN WINDOW. Window styles can also be specified at form level, with the WINDOWSTYLE form attribute in LAYOUT.
The ui.Window built-in class can be used to manipulate windows as objects. The common practice is to get the current form of the window and use it as ui.Form object to manipulate its content.
The windows can be displayed in an WCI container application, by using the ui.Interface methods to define parent / child relationship.
Forms define the layout and presentation of areas used by the program to display or input data. Forms are loaded by programs from external files with the .42f extension, the compiled version of .per form specification files.
Forms can be stamped with the VERSION attribute. The form version attribute is used to indicate that the form content has changed. The front end is then able to distinguish different form versions and avoid saved settings being reloaded for new form versions.
A program can load a form file with the OPEN FORM instruction, then display the form with DISPLAY FORM into the current window, and release resources with CLOSE FORM. For temporary popup windows (typical record list where the user can select a row), you must dedicate a new window for the form. Opening a new window with a form is done with a single OPEN WINDOW ... WITH FORM instruction.
Once a form is displayed, it is attached to the current window and a ui.Form object is created internally. You can get this object with the ui.Window.getForm() method. The ui.Form built-in class is provided to handle form elements. You can, for example, hide some parts of a form.
The Form that is used by interactive instructions like INPUT is defined by the current window containing the form. Switching between existing windows (and thus, between forms associated to the windows) is done with the CURRENT WINDOW instruction.