Programs manipulate windows and forms, to define display and input areas controlled by interactive instructions such as the INPUT dialog. When a dialog is started, 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, menus, message and error lines. A window can contain only one form at a time, but you can display different forms successively in the same window.
When using a the text mode (FGLGUI=0), windows are displayed in the character terminal as fixed-size boxes, at a given line/column position, width and height. When using a graphical desktop front end (FGLGUI=1), windows are displayed as independent re-sizeable windows by default. Note that a GUI application can run in traditional mode (gui.uiMode="traditional" FGLPROFILE setting), displaying windows as simple static areas inside a real graphical parent window. When using a mobile device front-end, only one window is visible at the time, because of device platform GUI standards and the limited screen sizes (smartphones). Split views is the exception, and allows to display two windows side by side for a typical list-detail display on tablets.
OPEN WINDOW mywindow WITH FORM "myform" ... CLOSE WINDOW mywindow
OPEN WINDOW mywindow WITH FORM "form1" INPUT BY NAME ... -- uses form1 elements ... OPEN FORM f1 FROM "form2" DISPLAY FORM f1 -- removes "form1" from the window INPUT BY NAME ... -- uses form2 elements ...
MAIN -- The SCREEN window exists by default ... OPEN FORM f_main FROM "customers" DISPLAY FORM f_main -- displays in SCREEN ... END MAIN
Several windows can be created, but there can be only one current window when using modal dialogs (only one dialog is active at the time, thus only the current window can be active). By using parallel dialogs, several windows can be active concurrently. Parallel dialogs were introduced to implement split views, for mobile devices.
OPEN WINDOW w_customers ... OPEN WINDOW w_orders ... ... CURRRENT WINDOW IS w_customers ... CLOSE WINDOW w_customers CURRRENT WINDOW IS w_orders ...
OPEN WINDOW w_cust WITH FORM "f_cust" ATTRIBUTES(TYPE=LEFT) ... OPEN WINDOW w_pref WITH FORM "f_pref" ATTRIBUTES(TYPE=POPUP) ...
OPEN WINDOW w_cust WITH FORM "f_cust" ATTRIBUTES(STYLE="dialog2")
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 dialogs (INPUT), 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 applied for new form versions.
OPEN FORM f_cust FROM "f_cust" DISPLAY FORM f_cust -- into current window ... OPEN WINDOW w_cust WITH FORM "f_cust"
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.
OPEN WINDOW w_common WITH 20 ROWS, 60 COLUMNS ... OPEN FORM f1 FROM "f_cust" DISPLAY FORM f1 -- f_cust is shown INPUT BY NAME rec_cust.* ... ... OPEN FORM f2 FROM "f_ord" DISPLAY FORM f2 -- f_ord is shown (f_cust is removed) INPUT BY NAME rec_ord.* ...
The ui.Form built-in class is provided to handle form elements. You can, for example, hide some parts of a form with the setElementHidden() method. Get a ui.Form object with the ui.Window.getForm() method.