Re: Raising widget above non-parent Toplevel?

Slaven Rezic <[email protected]> 11 Jul 2007 01:13:47 +0200
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Wilbert Knol <[email protected]> writes:

> Thanks for reading this.
> 
> I have an application implemented as two separate windows: a MainWindow and a 
> Toplevel.
> 
> The MainWindow occasionally spawns a warning (a homebrew dialog box) which 
> needs to be unconditionally visible, has to have the focus, grab the keyboard 
> etc....so I do things like this:
> 
> $warning->transient($warning->Parent->toplevel);
> $warning->grab;
> $warning->raise;
> $warning->focus;
> $warning->waitWindow;
> 
> All of this works fine...provided the parent MainWindow has the focus.
> 
> If, however, the Toplevel has the focus, then the $warning pops up underneath 
> the Toplevel and is not (or only partially) visible.
> 
> My question: is there a way to force the warning widget above the non-parent 
> Toplevel? If so, how?

With very modern Perl/Tk and modern window managers:

        $toplevel->attributes(-topmost => 1)

For older systems there is a module Tk::StayOnTop on CPAN.

Regards,
        Slaven

-- 
Slaven Rezic - slaven <at> rezic <dot> de

Tk-AppMaster: a perl/Tk module launcher designed for handhelds
	http://tk-appmaster.sf.net
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk