Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

perl Tk focus question

by chuleto1 (Beadle)
on Aug 22, 2002 at 21:56 UTC ( #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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2023-12-11 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?