Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Presumably some here are fluent in Perl/TK as well. I'm trying to use it for the first time, and I've run into a couple of issues (I'm using Tk::DialogBox):

1. I'm trying to display a dialog box by itself - however it seems the parent window always shows up behind it, even though it's empty. I'm trying to find a way to not have the parent display at all. I'm using the following code:

my $top = MainWindow->new(); my $next = $top->DialogBox(-title=>"Qconnect", -buttons=> ["OK", "Canc +el"], -default_button=>"OK"); my $next2 = $next->add ('Label', -text=>"Enter agent ID:")->pack(-side +=>'left'); my $next3 = $next->add ('Entry', -textvariable=>\$port, -width=>8)->pa +ck; $next->Show; $top->destroy; MainLoop();

2. I'm trying to find a way to make the text entry field (as shown above) the active field from the start, so that users can just type the entry without having to click on the text area first.

Thanks,

Glenn

Replies are listed 'Best First'.
(ichimunki) Re: Perl/TK dialog boxes
by ichimunki (Priest) on Aug 15, 2001 at 22:19 UTC
    $next3->focus; or $next3->focusForce;
    Read all about it in 'perldoc Tk::focus'.
Re: Perl/TK dialog boxes
by clintp (Curate) on Aug 15, 2001 at 23:29 UTC
    Try changing the code to this:
    $top->withdraw; $next->Show; $top->destroy;
    That'll hide the MainWindow.