Commit 8602252d authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Make use of the accelerator feature of DialogBoxUL

parent e45d5db1
......@@ -2,11 +2,11 @@ package Tk::FIJIModalDialog;
use Log::Log4perl qw(get_logger);
use Tk;
use Tk::widgets qw(LabFrame Label Entry Button DialogBox);
use Tk::widgets qw(LabFrame Label Entry Button DialogBoxUL);
use Tk::PNG;
use File::Spec;
use base qw(Tk::DialogBox);
use base qw(Tk::DialogBoxUL);
Construct Tk::Widget 'FIJIModalDialog';
sub ClassInit {
......@@ -34,8 +34,10 @@ sub Populate {
my $esc_button;
if (@buttons == 1) {
$esc_button = @buttons[0];
$esc_button =~ tr/~//d; # filter ~
} else {
foreach my $b (@buttons) {
$b =~ tr/~//d; # filter ~
if ($b eq "Cancel") {
$esc_button = $b;
last;
......
......@@ -147,7 +147,7 @@ sub netlist {
-text => $msg . "\n" . "Proceed with new netlist nevertheless?",
-wraplength => 200,
-title => 'Warning',
-buttons => [qw/Yes No/]);
-buttons => [qw/~Yes ~No/]);
my $rv = $d->Show();
if (!defined $rv || $rv eq "No") {
......@@ -192,7 +192,7 @@ sub settings {
-text => $msg . "\n" . "Proceed with new netlist nevertheless?",
-wraplength => 200,
-title => 'Warning',
-buttons => [qw/Yes No/]);
-buttons => [qw/~Yes ~No/]);
my $rv = $d->Show();
if (!defined $rv || $rv eq "No") {
......@@ -1367,7 +1367,11 @@ sub _select_net_dialog {
$title = "Select Net" if (!defined $title);
my $d = $self->MainWindow->DialogBox(-title=>$title, -buttons=>[qw/OK Cancel/],-default_button=>'OK');
my $d = $self->MainWindow->DialogBox(
-title => $title,
-buttons => [qw/~OK ~Cancel/],
-default_button =>' OK'
);
$d->bind('<Return>', => sub {});
my $sel = $d->FIJINetSelection(-nets =>$self->{'nets'}, -netname_ref=>$netname_ref);
......@@ -1425,7 +1429,7 @@ sub _select_driver_dialog($) {
}
# Build the DialogBox
my $d = $self->DialogBox(-title => "Driver for FIU $fiu_idx", -buttons => ["OK", "Cancel"]);
my $d = $self->DialogBox(-title => "Driver for FIU $fiu_idx", -buttons => ["~OK", "~Cancel"]);
my $f = $d->add('Frame');
Tk::FIJIUtils::set_icon($d);
......
......@@ -888,7 +888,7 @@ sub edit_test {
my $test = @{$self->{'tests'}->{'tests'}}[$i];
my $db = $self->{'mw'}->FIJIModalDialog(
-title => "Edit Test $i",
-buttons => [qw(OK Cancel)],
-buttons => [qw(~OK ~Cancel)],
);
$db->geometry("576x300");
my $tf = $db->FIJITestFrame(-test => $test, -settings => $self->{'settings'}, -scrolled=>1)->pack(-expand => 1, -fill => "both");
......
......@@ -136,7 +136,7 @@ sub show_about {
my $logo_image = logo_image($parent);
my $d = $parent->FIJIModalDialog(
-title => "About",
-buttons => ["Close"],
-buttons => ["~Close"],
-image => $logo_image,
-markuptext => $about_text,
);
......
......@@ -694,7 +694,7 @@ sub _overwrite_existing_file ($) {
my $d = $self->{'mw'}->FIJIModalDialog(-title => 'Really overwrite?',
-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-text => "File \"$filename\" already exists.\nDo you want to overwrite it?",
-buttons => ["Yes", "No"]);
-buttons => ["~Yes", "~No"]);
my $reply = $d->Show();
return (defined $reply && lc($reply) eq 'yes');
}
......@@ -769,7 +769,7 @@ sub _onexit {
-text => "Unsaved changes.\nDo you really want to quit?",
-wraplength => 350,
-title => 'Really quit?',
-buttons => ["Save", "Cancel", "Quit"]);
-buttons => ["~Save", "~Cancel", "~Quit"]);
$response = $d->Show();
$self->{'already_clicked'} = 0;
......
......@@ -572,7 +572,7 @@ sub _overwrite_existing_file ($) {
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-text => "File \"$filename\" already exists.\nDo you want to overwrite it?",
-title => 'Really overwrite?',
-buttons => ["Yes", "No"]);
-buttons => ["~Yes", "~No"]);
my $reply = $d->Show();
return (defined $reply && lc($reply) eq 'yes');
......@@ -612,7 +612,7 @@ sub _save_file {
-text => $rv . "Save Settings nevertheless?",
-wraplength => 350,
-title => 'Validation failed',
-buttons => [qw/Yes No/]);
-buttons => [qw/~Yes ~No/]);
my $save = $d->Show();
if (!defined $save || $save eq "No") {
......@@ -687,7 +687,7 @@ sub _onexit {
-text => "Unsaved changes.\nDo you really want to quit?",
-wraplength => 350,
-title => 'Really quit?',
-buttons => ["Save", "Cancel", "Quit"]);
-buttons => ["~Save", "~Cancel", "~Quit"]);
$response = $d->Show();
$self->{'already_clicked'} = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment