Re: "reconnecting" signals
| From: | Alan Knowles | Date: | Wed, 15 May 2002 14:50:54 +0000 |
| Subject: | Re: "reconnecting" signals | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1978@lists.php.net to get a copy of this message | ||
Theres two ways (ive found) to handle this
1. 'the gtk way' Connect and disconnect
$res = $object->connect(....)
---later----
$object->disconnect($res); // or similar...
$res = $object->connect(....)
.....
obviously you need to store that '$res'somewhere where the disconnect can get at it.... (globals or class vars for example)
2. 'the php way' have php handle different callbacks.....
$myhandler = new handler
$myhandler->callback = 'somefunction';
$object->connect('somecallback',array(&$myhandler,'callback'))l
// later on..
$myhandler->callback = 'anotherfunction';
class handler
var $callback;
function callback() {
call_user_function($this->callback,func_get_args());} } regards alan Henning Sprang wrote:
Hy all, another problem, as before, when changing the label of my button i want to change the action it does when clkicking on it, too. when calling the connect method a second time i get the effect that the connected function is executed immediatly with the call to connect, not only within the next click on the button. is there a way to solve this? i didn't find a disconnect function when looking for this. henning