in reply to Cancel close of mainwindow in Tk on Windows
A word spoken in Mind will reach its own level, in the objective world, by its own weight ,use Tk; use Tk::Dialog; my $mw = new MainWindow; $mw->Button( -text => "Exit", -command => \&confirm_exit )->pack; $mw->protocol( WM_DELETE_WINDOW => \&confirm_exit ); my $exit_dlg = $mw->Dialog( -text => "Really exit?", -buttons => [qw(Y +es No)], -default_button => 'Yes' ); MainLoop; warn "exited MainLoop\n"; sub confirm_exit { my $yn = $exit_dlg->Show; $yn =~ /y/i or return; warn "destroying MainWindow\n"; $mw->destroy; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cancel close of mainwindow in Tk on Windows
by cadphile (Beadle) on Oct 11, 2007 at 23:55 UTC |