User interface programming / Dialog programming basics |
Application forms are controlled by interactive instruction blocks called dialogs. These blocks perform the common tasks associated with the form, such as field input and action handling.
The interactive instructions allow the program to respond to user actions and data input.
The DISPLAY BY NAME / TO instruction allows you to display program variable data in the fields of a form and continue the program flow without giving control to the end user. This is in fact not an interactive instruction, as it just displays data to the current form, and returns immediately. However, it may be used in interactive instructions to display information to the end user. Note that when using the UNBUFFERED mode of a dialog, you do not need to is the DISPLAY BY NAME / TO instruction to synchronize program variables and form fields.
The MESSAGE and ERROR instructions are also simple display instructions without user interaction. These instructions are typically used to display a warning message to the end user.
The singular MENU instruction handles a list of choices to activate a specific function of the program. No field input is possible with this instruction. The user can only select an action from the list.
The singular INPUT instruction is designed for simple record input. It enables the fields in a form for input, waits while the types data into the fields, and proceeds after the user accepts or cancels the dialog.
The singular DISPLAY ARRAY instruction is used to browse a list of records. It allows the user to view the contents of a program array of records, scrolling the record list on the screen and choosing a specific record. DISPLAY ARRAY implements by default a read-only list of records, but can be extended to become a modifiable list with list modification triggers such as ON INSERT.
The singular INPUT ARRAY instruction supports record list input. It allows the user to alter the contents of records of a program array, and to insert and delete records.
The singular CONSTRUCT instruction is designed to let the user enter search criteria for a database query. The user can enter a value or a range of values for one or several form fields, and your program looks up the database rows that satisfy the requirements.
The procedural DIALOG instruction (placed in the program flow) allows you to combine several INPUT, DISPLAY ARRAY, INPUT ARRAY and CONSTRUCT functionality within the same form.
The declarative DIALOG block (defined at the same level as a function) allows you to implement indiviual MENU, INPUT, DISPLAY ARRAY, INPUT ARRAY and CONSTRUCT functionality, that will perform in parallel on sevaral forms, when used with the START DIALOG and TERMINATE DIALOG instructions. Declaractive DIALOG blocks can also be associated to a procedural DIALOG instruction through the SUBDIALOG clause, it will then act as a procedural DIALOG sub-dialog.
Interactive instructions can be implemented as modal or parallel dialogs. Modal dialogs control a given window, and that window closes when the dialog is accepted or canceled. The window displays on the top of any existing windows which are not accessible while the modal dialog executes. Parallel dialogs allow access to several windows simultaneously; the user can switch from on window to the other.