Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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
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? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2019-06-26 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (110 votes). Check out past polls.

    Notices?