Re: Forms 4.5 help

From: Steven J. Weisser <weisser_at_ecst.csuchico.edu>
Date: 1996/07/31
Message-ID: <Pine.HPP.3.92.960731220219.12921A-100000_at_steroid.ecst.csuchico.edu>#1/1


On Wed, 31 Jul 1996, Shawn Odekirk wrote:

> I am writing a multiple form application in Forms 4.5 under
> Windows95. I would like to be able to close the application
> by choosing File->Exit or clicking on an Exit toolbar icon
> regardless of the number of forms that are open.
> Exit_Form closes the current form (or exits query mode!),
> but how do I close all of the forms at once?
>
> Any help is greatly appreciated.
>
> Shawn
>
>
Shawn,

Try this(but you might want to check the syntax and the names of the triggers first I'm writing from memory here):

In your main form (or first form loaded) write a when_new_form_instance trigger
as follows:
:GLOBAL_EXIT_FLAG := 'NO'; --SETS EXIT FLAG TO 'NO' In all of your form (including the "main form") write this when_window_activated trigger:

BEGIN
IF :GLOBAL_EXIT_FLAG = 'YES' THEN
        EXIT_FORM(ASK_COMMIT); -- IF THE EXIT FLAG IS YES, EXIT THE FORM END IF;
END; Finally, in your when_button_pressed trigger for the exit button write this:
:GLOBAL_EXIT_FLAG := 'YES';-- SETS THE EXIT FLAG TO YES EXIT_FORM(ASK_COMMIT); -- EXITS THE FORM When the user exits the current form it the next form that is open will be activated and the when_window_activated trigger will fire and since the exit flag has been set to 'YES', that form will also be closed and so on...

This same PL/SQL (the when_button_pressed stuff) won't work from a menu item. For some reason you can't directly reference Forms variables (even Globals) from menus. Instead you have to use a function to indirectly set the flag variable to 'YES'. It's easy, but I can't think of the the exact syntax right now. If you can't figure it out from the online help (it's in there somewhere) email me and I'll send you more info.

Good luck,
Steve Weisser Received on Wed Jul 31 1996 - 00:00:00 CEST

Original text of this message