Hey wise monks!

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.