Re: infinite loop problem :( - solved
| From: | lukas at pronet dot lublin dot pl | Date: | Tue, 10 May 2005 12:52:05 +0000 |
| Subject: | Re: infinite loop problem :( - solved | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-5838@lists.php.net to get a copy of this message | ||
I tried using GtkObject signal_handler_[un]block methods and it works.
Summary:
If we have GtkWindow and GtkScrolledWindow and GtkAdjustment:
<?php
$oGtkWindow =& new GtkWindow();
$oGtkScrWindow =& new GtkScrolledwindow();
$oGtkAdj =& $oScrWindo->get_vadjustment();
$oClist =& new GtkClist();
$oGtkWindow->add( $oGtkScrWindow );
$oGtkScrWindow->add( $oClist );
?>
and we using signals like below:
<?php
$oGtkWindow->connect('check-resize', 'SomeFunction');
$signal_handler = $oGtkAdj->connect('value-changed', 'SomeFunction');
?>
Assuming that SomeFunction() changes Clist in that way that $oGtkAdj emits
'value-changed' signal we falls into loop.
To avoid this we have to define functions BlockAdj() and UnblockAdj() that will
block signal handler stored in $signal_handler var
And then we have to connect signals like below:
<?php
$oGtkWindow->connect('check-resize', 'BlockAdj');
$oGtkWindow->connect('check-resize', 'SomeFunction');
$oGtkWindow->connect('check-resize', 'UnblockAdj');
$signal_handler = $oGtkAdj->connect('value-changed', 'SomeFunction');
?>
--
sorry for my not to good english
Łukasz Wojciechowski