Document-ID:        32894.1
Subject:            EXITING MULTIPLE FORM APPLICATIONS
Author:             JHULBERT
Last Modified Date: 29 January   1996


                  Exiting Multiple Form Applications

Sometimes, you may want to give the user the ability to close all open
forms in a multiple form application by selecting a menu item or
clicking on a button.  This technical bulletin describes how to do
this in Oracle Forms 4.5.x.

This document consists of the following sections:

      General Overview
      Triggers

General Overview
================
In order to close all open forms at one time, a global must be checked
when focus moves to each form.  This global will tell the form if it
should close itself or not.  This method works for forms that were
opened using CALL_FORM, OPEN_FORM, and/or NEW_FORM.  Whether the forms
were opened in a chain or all opened from the initial form does not
matter.  Focus will move through all forms no matter what sequence
they were opened in.

Triggers
========
You need three triggers to accomplish the desired results.  These are
as follows:

When-New-Form-Instance
      :global.quit_all := 'N';

  Note: Include this trigger on the initial form.
        This initializes the global variable.

When-Window-Activated
      IF :global.quit_all = 'Y' THEN
         EXIT_FORM;
      END IF;

  Note: This trigger needs to be on every form in the application,
  including the initial form.  Create it at the form level.  It fires
  when the form regains focus.

When-Button-Pressed
      :global.quit_all := 'Y';
      EXIT_FORM;

  Note: This trigger starts the closing process.  If the open forms
  share the same menu, consider using this trigger in an "EXIT ALL" menu
  item, instead of a button.  You will then only need this trigger for
  the menu.  Otherwise, you will have to apply it to a button on all
  forms where the user needs this functionality.

WARNING - Do not mix OPEN_FORM and CALL_FORM in a multiple form
application.  A problem occurs if you do the following:
  1.  Use OPEN_FORM to have form A open form B.
  2.  Use CALL_FORM to have form B open form C.
  3.  Switch back to form A, and execute EXIT_FORM.
Executing the EXIT_FORM causes form C to error off.