Can the source code for a module found on CPAN be changed?? I am trying to use Tk::DialogBox for a program but it doesn't let me place it on the screen where I want. I found Tk::XDialogBox which has the -from_x, -from_y options but it doesn't place the dialog box in front of my TOPLEVEL windows.
So I looked at the source for both and the Show method for XDIALOGBOX has #cw::Popup commented out! Well this is what I think makes it popup and go to the front. Here are the Show methods for both. I want to uncomment out that line and see if it works. Can this be done?
DIALOGBOX
Tk::DialogBox
sub Show { croak 'DialogBox: "Show" method requires at least 1 argument' if scalar @_ < 1; my $cw = shift; my ($grab) = @_; my $old_focus = $cw->focusSave; my $old_grab = $cw->grabSave; shift if defined $grab && length $grab && ($grab =~ /global/); $cw->Popup(@_); Tk::catch { if (defined $grab && length $grab && ($grab =~ /global/)) { $cw->grabGlobal; } else { $cw->grab; } }; if (my $focusw = $cw->cget(-focus)) { $focusw->focus; } elsif (defined $cw->{'default_button'}) { $cw->{'default_button'}->focus; } else { $cw->focus; } $cw->Wait; &$old_focus; &$old_grab; return $cw->{'selected_button'};
XDIALOGBOX
Tk::XDialogBox
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'}; }
In reply to DialogBox vs. XDialogBox by mikasue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |