|< 1 2 >| | 12 Einträge, 2 Seiten |
$mw->protocol("WM_DELETE_WINDOW" => sub { })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl
use strict;
use Tk;
my $mw = MainWindow->new();
$mw->protocol('WM_DELETE_WINDOW', \&ExitApplication);
MainLoop();
sub ExitApplication {
# Prepare dialog yes|no
my $dialog = $mw->Dialog(-text => 'Do you really want to quit?',
-bitmap => 'question',
-title => 'Quit?',
-default_button => 'Yes',
-buttons => [qw/Yes No/],
);
my $answer = $dialog->Show(); # and display dialog
if ($answer =~ /y/i){
# maybe do some cleaning up and
exit;
}
else {
# continue
}
} # sub ExitApplication
|< 1 2 >| | 12 Einträge, 2 Seiten |