Parallel dialog programming steps

This procedure describes how to implement parallel dialogs with a declarative DIALOG block.

  1. Create the forms and declarative dialog modules as described in Declarative dialog programming steps.
  2. Define a FUNCTION to create the dialog instance.
    1. 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 the OPEN WINDOW window-name WITH FORM instruction. If the window exists, make it current with the CURRENT WINDOW IS window-name instruction.
    2. Fill the module variables (the data model) with data. For lists, you typically use a result set cursor.
    3. Start the dialog with the START DIALOG dialog-name instruction.
  3. Define a FUNCTION to terminate the dialog instance.
    1. In the function, finish the dialog with TERMINATE DIALOG dialog-name.
    2. Close the window dedicated to the dialog with CLOSE WINDOW window-name.
    3. If needed, free the data model (clear large program arrays) and database cursors, to save memory.
  4. 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.
  5. In another module, implement the WHILE loop using the fgl_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()