Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: Perl/Tk: Dialog boxes for idiots (me)

by herby1620 (Monk)
on May 05, 2006 at 16:30 UTC ( [id://547697]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Perl/Tk: Dialog boxes for idiots (me)
in thread Perl/Tk: Dialog boxes for idiots (me)

Yes, it seems as though MessageBox is the exception. As you show, one can have the main window 'withdrawn' and the message box appears. Obviously there is some flag that allows this (or am I assuming something here?). All I'm asking is that the dialog box have the same ability. I'm willing to "manually" set the proper flag (if possible) for Dialog. At the moment I've resorted to making the main window small and in one of the corners (it has nothing in it). Maybe all of this is buried deep inside Tk and it can't be changed from the Perl prespective. While I do remain hopeful, I have a solution that works for me.

Thanks to all.

  • Comment on Re^4: Perl/Tk: Dialog boxes for idiots (me)

Replies are listed 'Best First'.
Re^5: Perl/Tk: Dialog boxes for idiots (me)
by jdtoronto (Prior) on May 05, 2006 at 18:19 UTC
    Well, you can iconise the MainWindow, or in Tk speak - iconify.

    Although I don't have the documentation handy, the MainWindow is merely a special case of a "Toplevel" widget. Special in that it is displayed automatically when you call MainLoop. It is displayed automatically, but every other "Toplevel" must be spcifically placed using one or another of the geometry managers. Thus having created your MainWindow you should then be able to call the iconfy method:

    $mw->iconify();
    and have the pesky window disappear. To get it back?
    $mw->deiconify();

    However it may not reappear on the top of the other windows, to ensure this use the raise method:

    $mw->raise();
    jdtoronto
      Ah, yes, iconify, I know him well. Well, I tried that and while it nicely DOES iconify the main window, the Dialog box is iconified as well. Sorry about that. I thought it was a good idea as well.

      The "find the flag" idea based on the fact that messageBox is related to Dialog is good as well. An exercise for all.

      Why am I doing all of this? I'm running a script that is called by another (seperate Perl invocation) to do some tasks. I thought that having things like 'alert boxes' and 'dialog boxes' (admitally modal things) would be something desirable. So here I am. And so it goes.....

Re^5: Perl/Tk: Dialog boxes for idiots (me)
by jdtoronto (Prior) on May 05, 2006 at 18:37 UTC
    Well, MessageBox is derived from Dialog, as is DialogBox. So there must be some way of doing it, but I don't think it is a simple 'find the flag' exercise. This thread has been inetersting because I have never had a situation where I wanted a DialogBox without the MainWindow.

    jdtoronto

Re^5: Perl/Tk: Dialog boxes for idiots (me)
by runrig (Abbot) on May 05, 2006 at 20:23 UTC
    Use the source, Luke! ( Look at the source to MessageBox() in Tk.pm ). It seems to just use Tk::Dialog. It shouldn't be too hard to figure out what the secret is to getting the results you want.
      Did anyone find what messageBox's secret ingredient is ? I have been looking and making experiences for quite some time without finding anything :(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://547697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found