I run the following code, and when I click the little X, I get "the main loop has ended normally at - line 4.".
use Tk;
tkinit;
MainLoop;
die "the main loop has ended normally";
__END__
You can run whatever code you want after MainLoop returns (the user exits the gui).
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] [d/l] |
I think you can register a callback for the WM_DELETE_WINDOW property that shuts down gracefully. I don't have my example code with me, but it should be in the Perl/Tk book. Something like:
$toplevel->protocol( WM_DELETE_WINDOW, \&end_gracefully );
| [reply] [d/l] [select] |
You are looking for
$main_window->OnDestroy( sub { ExitProgram() } );
You can register whatever exit function you need in the OnDestroy call. OnDestroy will be called when you end your application. | [reply] [d/l] |
Have you looked at the END Block?
-Waswas | [reply] |