For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > February 2008 > Using busy and unbusy









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using busy and unbusy
Nishant

2008-02-21, 4:22 am

Hi ,
I have a button on which I have made following bindings -
$stop_button->bind('<Enter>' => sub {
print "in \n";
$mw_wizui->Unbusy(-recurse => 1);}
);

$stop_button->bind('<Leave>' => sub {
print "out \n";
$mw_wizui->Busy( -recurse => 1, -cursor =>
'watch' );
}
);

$stop_button->bind( '<1>' => sub {
print "stop \n";
&stop;
}
);

Now, on one machine in our network , what is happening is that while
moving the mouse over the stop button, it gets into that function and
similarly for 'Leave; event. But, when I'm clicking on that button ,
both "in" and "out" get printed one after another, because of which
"stop" (as printed in the button-1 bindings function) does not get
executed.
So , can anyone suggest what the issue could be , I mean machine
related issue ?

Regards
Nishant Sharma
Slaven Rezic

2008-02-21, 7:08 pm

Nishant <nishant.031@gmail.com> writes:

> Hi ,
> I have a button on which I have made following bindings -
> $stop_button->bind('<Enter>' => sub {
> print "in \n";
> $mw_wizui->Unbusy(-recurse => 1);}
> );
>
> $stop_button->bind('<Leave>' => sub {
> print "out \n";
> $mw_wizui->Busy( -recurse => 1, -cursor =>
> 'watch' );
> }
> );
>
> $stop_button->bind( '<1>' => sub {
> print "stop \n";
> &stop;
> }
> );
>
> Now, on one machine in our network , what is happening is that while
> moving the mouse over the stop button, it gets into that function and
> similarly for 'Leave; event. But, when I'm clicking on that button ,
> both "in" and "out" get printed one after another, because of which
> "stop" (as printed in the button-1 bindings function) does not get
> executed.
> So , can anyone suggest what the issue could be , I mean machine
> related issue ?
>


I cannot reproduce this on my system (see script below). Which OS and
Perl/Tk version are you using?

#!/usr/bin/perl -w
use Tk;

$mw_wizui = $top = new MainWindow;

$stop_button=$top->Button->pack;
$top->Label(-text => "bla")->pack;
$stop_button->bind('<Enter>' => sub {
print "in \n";
$mw_wizui->Unbusy(-recurse => 1);}
);

$stop_button->bind('<Leave>' => sub {
print "out \n";
$mw_wizui->Busy( -recurse => 1, -cursor =>
'watch' );
}
);

$stop_button->bind( '<1>' => sub {
print "stop \n";
&stop;
}
);


MainLoop;

__END__

--
Slaven Rezic - slaven <at> rezic <dot> de

tkruler - Perl/Tk program for measuring screen distances
http://ptktools.sourceforge.net/#tkruler
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com