[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Mac::Dialogs questions



>2) If you create a dialog with MacDialog, display it, then hit command-period
>to terminate the script, the dialog box remains on screen.  Is there a
>way within a script to receive a notification that you've been aborted, so
>that some cleanup can be done?

If your dialog is an object (and it should be), make sure it has a DESTROY
method:

sub
DESTROY
{
    $_[0]->dispose; # or whatever you call the "go away" method
}

When the script is terminated, all the extant objects are auto-DESTROYed as
if they're going out of scope, so having a DESTROY method lets you clean up
stuff (like open windows) the perl doesn't know about itself.

Just had a thought--the END block gets run on command-period, you could
dispose of the dialog there. But then of course you have to keep track of
the dialog yourself instead of letting perl do it.

Brian



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch