in reply to Perl/Tk and "wait" box
This is untested, but may be a good start:
#!/usr/bin/perl my $top2 = MainWindow->new(); my $waitbox = $top2->WaitBox(-title=>"Connecting to agent $port", -txt1=>"Connecting to Agent $port.\nConnection will be establ +ished when this box closes.\n", -cancelroutine=>sub { print "\nCancelling...\n"; $top2->unShow; die} ); # pack the widgets $waitbox->pack; # encapsulate the wait box posting # and the connect routine in a sub # ( the waitbox is just using a "grab" and "focus", # if you want to roll your own, see Tk::Grab ) sub doyourstuff { # post the waitbox, this doesn't block # the process, it just grabs all the keyboard # and mouse events and discards them for a while $waitbox->Show; # do your connect stuff here for (1..10) { print STDERR "waiting $_\n"; sleep(1); } # get rid of the waitbox and start taking mouse/kb # events again. $waitbox->unShow; } # schedule the doyourstuff subroutine to # run in 0 ms $top2->after(0,\&doyourstuff); MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Perl/Tk and "wait" box
by Ven'Tatsu (Deacon) on Aug 17, 2001 at 05:47 UTC | |
|
Re: Re: Perl/Tk and "wait" box
by Anonymous Monk on Aug 17, 2001 at 20:44 UTC | |
|
Re: Re: Perl/Tk and "wait" box
by Anonymous Monk on Aug 17, 2001 at 19:17 UTC |