Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Tk MainWindow from module Foo on to appear on top

by batkins (Chaplain)
on Oct 25, 2003 at 17:41 UTC ( #302082=note: print w/replies, xml ) Need Help??

in reply to Tk MainWindow from module Foo on to appear on top

First of all, don't use multiple MainWindows. It's certainly possible, but parts of Tk aren't reliable when used with multiple MainWindows. Your best bet is to use Toplevels. You create one MainWindow and then create the other windows by making Toplevels from the MainWindow
my $win = $mw->Toplevel(-title => 'ererree');
If you don't want to have one and only one MainWindow (remember that closing a MainWindow exits your program), you can use only Toplevels and call $mw->withdraw immediately after creating the MainWindow. Your MainWindow will then be invisible and you'll only have Toplevels, which can be closed without requring the program to end.

As far as your actual question, try $win->focus, where $win is the name of the window you want to bring to the front.

The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa

Replies are listed 'Best First'.
Re: Re: Tk MainWindow from module Foo on to appear on top
by aplonis (Pilgrim) on Oct 25, 2003 at 19:02 UTC
    Yes, your suggestion works better yet. I will
    today fix my modules for Toplevels as apposed
    to MainWindows. And using $help_foo->focus
    works by itself without having to lower, raise the
    other window beforehand.

    Thanks again!

    This project to appear updated per todays meditative
    realization soon at Test Log GUI

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2022-12-03 23:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found