on startup and on shutdown
Martin Baxter
martin at harbourtown.co.uk
Sun Jan 11 11:48:23 EST 2004
>Thomas J McGrath III wrote>
>I just found the on startup and on shutdown handlers. I have tried to
>clean up my CD project by putting the initializers into these handlers.
>The docs say that is what they are for.
>
>Has anyone used these that much?
I use on startup and rely on it.
It's true that it doesn't run in the IDE, only in a standalone. So what I
do, in outline is...
on startup
# do things that only need to be done when run as a standalone
initialise
end startup
on initialise
# read prefs files, set up global environment etc.
if the environment "development" then
# do things that only need doing in the IDE
end if
end initialise
Rather than use a preopenstack handler to run initialise automatically in
the IDE (which has potential problems you have found out already by the
sound of it), I either run initialise from the message box by hand, or
sometimes include a temporary (during development) menu item to run it.
The latter approach can sometimes be handy when testing a standalone, as it
allows you to reinitialise - should you need to - without having to quit
and relaunch the application.
Of course that menu item would be removed from a published build.
shutdown I never used, but actually I think it might be a good idea of I did.
It looks like probably the most logical point to save an application's
session state variables to disk.
Martin
More information about the use-livecode
mailing list