Project Events

Project events happen at the application level; they are triggered when your AutoPlay application is started or exited.

There are three project events: On Initialize, On Close, and On Destroy.

On Initialize

On Initialize is triggered right after the user launches your AutoPlay application, before any pages are initialized and shown.

This is a good place to put any "initialization" actions, such as setting default values for "global" variables that are used throughout your project, or comparing the date on the user's system with a date that you want your application to expire on.

On Close

On Close is triggered when the user attempts to exit your AutoPlay application, usually by clicking on the application window's Close gadget ( ) 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).

On Destroy

On Destroy 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.

You can add actions to these events on the Actions tab of the Project Settings dialog.

NOTE

 

 

 

The sequence of events when the application is started is:

(application) On Initialize
(start page) On Initialize
(start page) On Show

The sequence of events when the application is closed is:

(current page) On Close
(current page) On Destroy
(application) On Close
(application) On Destroy

Next: Starting a New Project