Parallel dialog programming steps
This procedure describes how to implement parallel dialogs with a declarative
DIALOG
block.
- Create the forms and declarative dialog modules as described in Declarative dialog programming steps.
-
Define a
FUNCTION
to create the dialog instance.-
Add a test to check if the window and form combination dedicated to the
dialog is already created, using
ui.Window.forName()
. If the window does not yet exist, create it by using theOPEN WINDOW window-name WITH FORM
instruction. If the window exists, make it current with theCURRENT WINDOW IS window-name
instruction. - Fill the module variables (the data model) with data. For lists, you typically use a result set cursor.
-
Start the dialog with the
START DIALOG dialog-name
instruction.
-
Add a test to check if the window and form combination dedicated to the
dialog is already created, using
- Define a
FUNCTION
to terminate the dialog instance.-
In the function, finish the dialog with
TERMINATE DIALOG dialog-name
. -
Close the window dedicated to the dialog with
CLOSE WINDOW window-name
. - If needed, free the data model (clear large program arrays) and database cursors, to save memory.
-
In the function, finish the dialog with
-
If needed, add an
ON ACTION close
action handler to the declarative dialog, that calls the terminate function. This allows the end user to close the front-end window and stop the dialog. -
In another module, implement the
WHILE
loop using thefgl_eventLoop()
built-in function to handle interaction events for parallel dialogs. This module uses the start and terminate functions to control the individual dialog modules.The simplest form of the user interaction event loop is:WHILE fgl_eventLoop() END WHILE