Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I've finally gotten back to trying to force Perl/Tk to operate with professional dialog box functionality.

The problem with Tk::Dialog and Tk::DialogBox is that they both want to manage the closing buttons in a separate bottom section of the dialog box. From my understanding, there is no way to intercept the results of the bottom buttons. Actually, there is a built-in mechanism through the -command option, and that is where you can save data, etc. But once the bottom button is clicked, you can't cancel it (for example, if the user forgot to enter a critical field) and force the dialog to stay open.

The good thing about Tk::Dialog and Tk::DialogBox is that they don't appear to create separate applications with icons showing on the bottom of the display (in Win32). This is despite the fact that both are derived from Tk::Toplevel.

As I mentioned earlier, Tk::Toplevel provides a method for building completely functioning dialog boxes with total control of all widgets and processing. There is a drawback, however, in the fact that every Tk::Toplevel is treated by Tk as if it were a separate application, which shows up as an icon on the bottom of the display.

The only workaround I've been able to come up with is to use the toplevel->withdraw() function in both the calling module (when it calls a module that has its own respective Toplevel) and then in the called module when it closes down. The crazy thing about this is that the callee must have a link back to the caller, i.e., a subroutine call, to tell the caller that the callee has completed its processing and withdrawn itself, and that it's time for the caller to deiconify() and raise() itself.

The use of withdraw() in this way prevents the situation where there are multiple application icons. It's not perfect, however, as I can literally see the withdrawing of one module and the raising of another as the icons repaint themselves at the bottom of the display. But that's a small price to pay for having the control of the Toplevel serving as a dialog: I can completely manage the exiting process and I fully control the positioning of all widgets within the Toplevel (whereas with Tk::Dialog and Tk::DialogBox I have no control of the button placement).

If anyone has any suggestions or insights where I may be making a mistake or may be overlooking some option that might make the Tk::Dialog and Tk::DialogBox processing work better, please let me know. Thanks.

Tom


In reply to Re: Perl/Tk Oddities by TomKane
in thread Perl/Tk Oddities by TomKane

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2018-11-14 08:58 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My code is most likely broken because:
















      Results (165 votes). Check out past polls.

      Notices?