sub Show { my ($cw, $grab) = @_; croak 'DialogBox: "Show" method requires at least 1 argument' if scalar @_ < 1; my $old_focus = $cw->focusSave; my $old_grab = $cw->grabSave; # $cw->Popup(); $cw->update; Tk::catch { if (defined $grab && length $grab && ($grab =~ /global/)) { $cw->grabGlobal; } elsif(defined $grab && length $grab && ($grab =~ /nograb/)) { # No Grab } else { $cw->grab; } }; if (defined $cw->{'focus'}) { $cw->{'focus'}->focus; } elsif (defined $cw->{'default_button'}) { $cw->{'default_button'}->focus; } else { $cw->focus; } $cw->Wait; &$old_focus; &$old_grab; return $cw->{'selected_button'}; }