Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Tk MainWindow and another TopLevel spawn order (taskbar order LIFO win32)

by Anonymous Monk
on Sep 21, 2016 at 09:48 UTC ( [id://1172293]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Tk MainWindow and another TopLevel spawn order (taskbar order LIFO win32)
in thread Tk MainWindow and another TopLevel spawn order

but i'm curious to know where you found this information or if just comes from your tries.

Just from tries, its simpler than reading the source

How can i retrieve more infos about tkinit anyway? in the Tk source I just see: It is just a shortcut to call for a MainWindow creation?

Its one of those things monkey see, and yes its just a shortcut , its defined inside Tk.pm, just like MainLoop

sub tkinit { return MainWindow->new(@_) } sub MainLoop { unless ($inMainLoop) { local $inMainLoop = 1; while (Tk::MainWindow->Count) { DoOneEvent(0); } } }

Anyway I prefere the pryrt's solution ...

Yes, parents kill children, but you don't gotta let the user kill the window so you have to recreate it, just hide/show

#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = MakeMain(); my $phwin = MakePhwin( $mw ); $mw->focus; $mw->WidgetDump; MainLoop; sub MakePhwin { my( $mw ) = @_; my $phwin = $mw->Toplevel; $phwin->protocol( 'WM_DELETE_WINDOW', [sub{shift->withdraw}, $phwi +n], ); $phwin->Label(-text => "Close me hit the little x" )->pack; return $phwin; } sub MakeMain { my $mw = tkinit(@_); $mw->Button( -text => "Restore phwin", -command => sub { $_->deiconify for grep $_->isa('Tk::Toplevel'), $Tk::widget->toplevel->children; }, )->pack; $mw->update; return $mw; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found