In a previous message I asked about exiting from 'MainLoop', and got a couple of answers. One included exactly what I needed for one instance (Message Box). Now I'm trying to pop up a box (Yes, this is W-XP [yuck!]) and have a couple of selections to pick from. I thought I would use a dialog box, and I'm trying this simple code:
# Try to get a simple dialog box to work.
use Tk; # Bring in the Tk stuff.
my $mw = MainWindow->new;
# Get rid of main window, but keep some of it around.
print "Main window created, withdrawn\n";
my $dialog = $mw->DialogBox (-title => "Please pick one of the three",
-buttons => ["One", "Two", "Three"]);
my $item = $dialog->Show(); # ???
print "Returned from the show, got $item\n";
The problem is that the above example when run on WXP hangs at the ->Show() statement. From what I can tell, the execution focus is somewhere else (it goes away from my command window) and it may be displaying something "invisable". Since it isn't displayed, I can't do anything, and it hangs. To exit, I type ^C and the interrupt kills the script. Can this be made to work? I was very able to get the messageBox to function WITHOUT going into 'MainLoop', can I do something similar here???
Your wisdom would be quite helpful. Past incantations of wisdom have been MOST helpful!! Thanks!!
It seems that the dialog box is tightly linked to the parent window. They can't (with the code above) be seperated. Even if I try to 'deiconify' the dialog box, until the main window becomes 'normal' it won't happen! Somehow 'messageBox' is able to disconnect these, but THAT is buried pretty deeply in the Tk library (I tried to look for how without luck). Still looking for "secret sauce".