mnooning has asked for the wisdom of the Perl Monks concerning the following question:
I am writing an event driven system wherein as one top level window is
closed, another pops up. I provide an Exit button on each window that
has it's own routine for cleaning up and exiting. If the user instead
clicks the upper right window cross hair to close the window, I still
want to go to the said cleaning up routine. The call below does not
work. $top of course is a Toplevel reference.
$top->protocol( 'WM_DELETE_WINDOW', \&my_clean_up_routine( $top, $another_parameter);
The call is fashioned after this example from http://www.lns.cornell.edu/~pvhp/ptk/ptkFAQ.html
$window->protocol('WM_DELETE_WINDOW',\&your_exit_handler);
Perhaps the problem is that no parameters are allowed. I am guessing
that because the code below works in that if using it, the said cross
hairs will not close the window out, which breaks tradition.
$window->protocol( 'WM_DELETE_WINDOW', \&Tk::NoOp);
Any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl/Tk window->protocol question
by jdporter (Paladin) on Mar 17, 2006 at 18:06 UTC | |
|
Re: Perl/Tk window->protocol question
by zentara (Cardinal) on Mar 17, 2006 at 18:44 UTC | |
by mnooning (Beadle) on Mar 17, 2006 at 19:33 UTC |