Announcement

Collapse
No announcement yet.

INFO: The Difference between the "On Close" and "On Destroy" Events

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • INFO: The Difference between the "On Close" and "On Destroy" Events

    INFO: The Difference between the "On Close" and "On Destroy" Events

    INFO: The Difference between the "On Close" and "On Destroy" Events

    Document ID: IR04014
    The information in this article applies to:
    • AutoPlay Media Studio 4.0

    SUMMARY

    This article will explain the difference between the "On Close" and "On Destroy" events.

    DISCUSSION

    In AutoPlay Media Studio 4.0 both the Project, and each Page, have "On Close" and "On Destroy" events. These events are similar but in order to use them properly you must be aware of their differences.

    Page

    The "On Close" event is triggered when something happens to "initiate" a page close, e.g., a Page.Jump action has been performed.

    At this point, you can override the closing of the page by setting the variable %PreventPageClose% to TRUE.

    The "On Destroy" event is only triggered after all of the "On Close" actions. At this point, the page is going to close, and there's nothing you can do to stop it from closing. The page is essentially deleted from memory (hence the name).

    Project

    The "On Close" event is triggered when the user attempts to exit your AutoPlay application, usually by clicking on the application window's Close button or as the result of an Application.Exit action.

    You could think of this event as the user "requesting" that the application be closed.

    This event allows you to "override" the user's request to exit (for example, until they have provided all the information you require for product registration) by setting the built-in variable %PreventApplicationClose% to TRUE (causing the user's close attempt to be ignored).

    The "On Destroy" event is triggered after the On Close actions have been performed and it has been determined that the AutoPlay application really will close. (In other words, %PreventApplicationClose% is currently set to false.) At this point, there is nothing you can do to prevent the application from closing—it will close, no matter what.

    This is where you should put any "on close" actions that you want performed when the application is about to shut down. For example, you may wish to delete any temporary files that were used by your application, or undo any other temporary changes that were made to the user's system. Or you might want to use a Dialog.Timed Message action to remind the users of something important as they go.

    So the main difference between the two events is that the "On Close" event is triggered at the first moment when it is known that the page/application is going to close. This occurs before the page/application has actually begun to close. Then the "On Destroy" event is triggered, this event occurs after the page/application has closed.

    MORE INFORMATION

    For more information please see the following topics in the AutoPlay Media Studio 4.0 Help:

  • Command Reference | Pages | Page Properties Dialog
  • Command Reference | Project Settings
  • KEYWORDS: AutoPlay Media Studio 4.0, Events, On Close, On Destroy


    Last reviewed: October 3, 2002
    Copyright © 2002 Indigo Rose Corporation. All rights reserved.
Working...
X