strat has asked for the wisdom of the Perl Monks concerning the following question:
I'm playing around a little bit again with Tk, and got the following problem:
If anybody just presses at the X at the upper right corner of the window or Alt+F4 (i mostly work under Win2k), the Window closes and the program finishes.
With something like the code above, I could at least do some cleanup before quitting.#!perl -w use strict; use Tk; my $mw = MainWindow->new(); $mw->OnDestroy( \&ExitApplication ); MainLoop; sub ExitApplication { print ("Exiting\n"); # do some cleanup }
What I'm looking for: if somebody presses the X at the top right corner of the window or Alt-F4, I want a MsgBox to pop up and ask "Do you really want to quit (Yes/No)", and if the user presses the Button for "No", the program should continue running. With OnDestroy, I only know a way to quit, but not to go on.
Best regards and thanx in advance,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk - intercepting alt-f4 and the like
by physi (Friar) on Mar 18, 2002 at 12:58 UTC | |
Re: Tk - intercepting alt-f4 and the like
by rbc (Curate) on Mar 18, 2002 at 16:15 UTC | |
Re: Tk - intercepting alt-f4 and the like
by strat (Canon) on Mar 20, 2002 at 14:50 UTC | |
Re: Tk - intercepting alt-f4 and the like
by strat (Canon) on Mar 18, 2002 at 16:30 UTC |