The DIALOG statement
A DIALOG
block implements a form controller that can handle all form
parts at the same time.
The
DIALOG
instruction body can define INPUT
,
CONSTRUCT
, DISPLAY ARRAY
and INPUT ARRAY
sub-dialogs blocks. All the form fields controlled by these sub-dialogs will be active at the same
time:DIALOG ...
INPUT BY NAME ...
END INPUT
DISPLAY ARRAY ...
END DISPLAY
...
END DIALOG
Best practice is to use the UNBUFFERED
attribute for the DIALOG
instruction (this will make all sub-dialogs use the unbuffered mode):
DIALOG ATTRIBUTES(UNBUFFERED)
Dialog control blocks such as
BEFORE ROW
, BEFORE FIELD
are also
available in the sub-dialogs of the DIALOG
instruction. The purpose and excution
sequence is similar to singular-dialogs. The big difference is with BEFORE INPUT
,
AFTER INPUT
, BEFORE DISPLAY
, AFTER DISPLAY
,
BEFORE CONSTRUCT
and AFTER CONSTRUCT
control blocks: In
DIALOG
sub-dialogs, these can be triggered multiple times during the dialog
execution. The BEFORE dialog-type
trigger is executed when the
focus goes to a field of the sub-dialog, and the AFTER
dialog-type
trigger is executed when the focus goes to a field of
another sub-dialog:DIALOG ...
INPUT BY NAME ...
BEFORE INPUT
MESSAGE "Now focus is in the INPUT sub-dialog"
AFTER INPUT
MESSAGE "Now focus leaves the INPUT sub-dialog"
END INPUT
...
END DIALOG
Each sub-dialogs can define its
ON ACTION
handlers, for actions be used in the
contact of the sub-dialog. Global dialog actions can be defined at the same level than
sub-dialogs:DIALOG ...
INPUT BY NAME ...
ON ACTION print
...
END INPUT
DISPLAY ARRAY ...
ON ACTION check_row
...
END DISPLAY
...
ON ACTION print_all
CALL print_customer_info()
...
END DIALOG
In a
DIALOG
block, the sub-dialogs must get a name to be identified.
INPUT
and CONSTRUCT
need to be configured with the
NAME
attribute, while DISPLAY ARRAY
and INPUT
ARRAY
sub-dialogs are implictly identified by the screen array name used to bind program
arrays and screen fields. Sub-dialog names are for example used to identify sub-dialog specific
actions:DIALOG ...
INPUT BY NAME rec_order.* ATTRIBUTES(WITHOUT DEFAULTS,NAME="orders")
END INPUT
DISPLAY ARRAY custarr TO sa_items.*
END DISPLAY
END DIALOG
Unlike singular-dialogs, the
DIALOG
instruction does not create automatic
accept
/cancel
actions. The typical ON ACTION
handler to be defined a the DIALOG
block level is for the close
action, to let the user close the window:DIALOG ...
...
ON ACTION close
EXIT DIALOG
END DIALOG
For more details, go to the Multiple dialogs chapter in the Genero Business Development Language User Guide.