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
FUNCTIONto 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 FORMinstruction. If the window exists, make it current with theCURRENT WINDOW IS window-nameinstruction. - 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-nameinstruction.
-
Add a test to check if the window and form combination dedicated to the dialog is already
created, using
- Define a
FUNCTIONto 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 closeaction 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
WHILEloop 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