Reliable way to do something on shutdown?
revdev at pdslabs.net
Tue Jun 18 20:55:33 EDT 2013
Maybe a shutDownRequest handler in the script of your mainStack would do
the job. In effect this lets you pause the shutdown process before it
does anything, make sure your external is closed, then pass
shutdownRequest. I think I would start there. Or 'closeStackRequest'
like Terry suggested - it would work in the IDE or the standalone. That
might be a better approach.
On 6/18/13 5:07 PM, Paul D. DeRocco wrote:
> My app uses an external, which if not properly closed causes LiveCode, or my
> standalone, to remain as an orphan process under Windows until I forcibly
> kill it. So far, I haven't figured out how to intercept the shutdown when it
> comes from the close button in the corner of the window.
> First, I tried adding a "shutdown" handler to my main stack, which didn't
> work. Then, I noticed the note in the Dictionary, and created an invisible
> button which had a "shutdown" handler, and made its script a backscript, but
> that didn't work. Then, I noticed that the Dictionary said that "shutdown"
> is sent to the current card of the defaultStack, and not the stack itself,
> so I gave the card a "shutdown" handler, but that didn't work.
> I don't really care if there's some reason this can't work in the IDE, since
> I can just remember to manually close the external. But it has to work in
> the standalone.
> My app, in case it matters, has a main stack with one card, and three
> subsidiary stacks for modal dialog boxes, none of which are open when the
> program is shut down. It works fine if I call "quit" from a menu handler,
> but not when I click the X in the corner. What's the right way to do this?
More information about the Use-livecode