Discipulus has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a Tk Perl program where i need to spawn immediately a secondary TopLevel window. I generaly use the code similar to that posted below.
All is fine BUT due to the call to the subroutine that draw the secondary windows placed before the MainLoop the secondary window is spawned before the main one and they are ordered incorrectly in the application bar of my OS.
I know the example where a button create a new TopLevel widget, but I want the secondary windows to spawn automatically at start time.
I know that the code is doing what I said it to do; how to code to do what i want?
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my $mw = new MainWindow (); $mw->title(" $0 MAIN"); my $phwin = $mw->Toplevel(); my $fr0 = $mw->Frame(-borderwidth => 2, -relief => 'groove' )->pack(); $fr0->Label(-text => "MAIN $0 MAIN" )->pack(); &secondary_win; MainLoop; ###################################################################### +########## sub secondary_win { # window does not exists if (! Exists($phwin)) { $phwin = $mw->Toplevel(); $phwin->title("SECONDARY"); } # window Exists else { $phwin->deiconify( ) if $phwin->state() eq 'iconic'; $phwin->raise( ) if $phwin->state() eq 'withdrawn'; } my $scrolledframe = $phwin->Scrolled('Frame',-scrollbars => 'osoe' +)->pack(); my $sec_label = $scrolledframe->Label(-text=>'SECONDARY')->pack; }
Thanks in advance
L*
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk MainWindow and another TopLevel spawn order
by pryrt (Abbot) on Sep 20, 2016 at 13:30 UTC | |
by Discipulus (Canon) on Sep 21, 2016 at 08:05 UTC | |
Re: Tk MainWindow and another TopLevel spawn order
by Corion (Patriarch) on Sep 20, 2016 at 09:29 UTC | |
Re: Tk MainWindow and another TopLevel spawn order (taskbar order LIFO win32)
by Anonymous Monk on Sep 20, 2016 at 17:31 UTC | |
by Discipulus (Canon) on Sep 21, 2016 at 08:47 UTC | |
by Anonymous Monk on Sep 21, 2016 at 09:48 UTC |