Procedural dialog programming steps
Follow this procedure to use the DIAOG
instruction.
To implement a procedural DIALOG
block:
-
Create a form specification file containing screen record(s) and/or screen array(s). The
screen records and screen arrays identify the presentation elements to be used by the runtime system
to display the data models (the content of program variables bound to the
DIALOG
blocks). -
With the
DEFINE
instruction, declare program variables (records and arrays) that will be used as data models. For record lists (DISPLAY ARRAY
orINPUT ARRAY
), the members of the program array must correspond to the elements of the screen array, by number and data types. To handle record lists, use dynamic arrays instead of static arrays. -
Open and display the form, using
OPEN WINDOW WITH FORM
or theOPEN FORM
/DISPLAY FORM
instructions. - Fill the program variables (the model) with data. For lists, you typically use a result set cursor.
-
Implement the
DIALOG
instruction block to handle interaction. Define each sub-dialog with program variables to be used as data models. The sub-dialogs will define how variables will be used (display or input).-
Inside each sub-dialog instruction, define the behavior with control blocks such as
BEFORE DIALOG
,AFTER ROW
,BEFORE FIELD
, and interaction blocks such asON ACTION
. -
To end the
DIALOG
instruction, implement anON ACTION close
orON ACTION accept
/ON ACTION cancel
to handle dialog validation and cancellation, with theACCEPT DIALOG
andEXIT DIALOG
control instructions. Theint_flag
variable will not be set as in singular dialogs.
-
Inside each sub-dialog instruction, define the behavior with control blocks such as