Re: Display Portions of an Image



Eric Andreychek wrote:

Aha!  That was exactly it.  The function in question is called like so:

 Glib::Timeout->add(2000, sub { $self->_update });

Adding "return 1" to the end of the _update function did fix the problem.

Now, there's something I don't understand -- why does that sub need to return
true?  Wouldn't the code within the sub be run regardless of the return value?

No. In case of a timeout, the return value controls whether the timeout
should continue or not. False stops the timeout. The same applies to I/O
watchers.

Also the return value of signal callbacks are important. Returning true
indicates that the signal was handled finally and no other signal 
handlers will be called (only important in case there is more than one 
handler connected to the signal, which is not unusal). If you have 
"strange" behaviour on the GUI, check your return values. They are 
important and you need them! ;)

Regards,

Joern

-- 
Joern Reder
supporting:   http://www.zyn.de/
unbelievable: http://www.exit1.org/
CPAN:         http://www.perl.com/CPAN/modules/by-authors/id/J/JR/JRED

Attachment: pgplBTW8yqK1I.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]