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

perl Tk focus question

by chuleto1 (Beadle)
on Aug 22, 2002 at 21:56 UTC ( [id://192188]=perlquestion: print w/replies, xml ) Need Help??

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

Once again I find myself asking for wisdom

I have a Tk window that at the click of a button will spawn a pop-up window. Is there a way to force the user to interact with the pop-up before going back to the parent window? I want to avoid the user going back to the parent window and spawing multiple pop-up windows before dispatching previous ones.
 Thank you

Replies are listed 'Best First'.
Re: perl Tk focus question
by dree (Monsignor) on Aug 22, 2002 at 22:20 UTC
    You can use the grab() function for the second window.
    See the example below:
    use strict; use Tk; my $mw = MainWindow->new( -height => 385, -width => 575); $mw->title ("Example"); #---------- Adding Button my $button = $mw->Button( -text => "Click me!", -relief => "raised", "-command"=>\&Click_me, ); $button->place( -x => 215, -y => 295, -height => 22, -width => 90); MainLoop; sub Click_me { my $mw2 = $mw->Toplevel( -height => 123, -width => 245); $mw2->title (""); $mw2->grab(); }

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-23 17:26 GMT
Find Nodes?
    Voting Booth?

    No recent polls found