Re: GladeXML: signal_autoconnect to an object?
| From: | Christian Weiske | Date: | Tue, 25 Oct 2005 06:25:14 +0000 |
| Subject: | Re: GladeXML: signal_autoconnect to an object? | ||
| References: | 1 2 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-1928@lists.php.net to get a copy of this message | ||
Good morning Steph,
> Staying with your example below, you need to declare either
> "self::btnClicked" or "MyApp::btnClicked" as the callback handler within
> the
> Glade file, rather than plain-vanilla "btnClicked".
MyClass::btnClicked works, but it's obvious a static call which should
be ok.
What not works is self::btnClicked, at least for all five of my signals
- I always get a
-------------------
cweiske:/data/php-gtk/two/PEAR_Frontend_Gtk2> p5 run.phpw
PHP Warning: Unable to invoke signal callback 'self::quitDialog'
specified in /data/php-gtk/two/PEAR_Frontend_Gtk2/Gtk2.php on line 55 in
/data/php-gtk/two/PEAR_Frontend_Gtk2/run.phpw on line 4
-------------------
But even self:: should have the meaning that the signal is being
connected to the static function of the current class. So I vote for no
prefix (no "self::" or so) if that's possible.
I added a test script in the test/ directory.
Btw, could it be that you forgot to commit your new_from_buffer-patch
which used strlen() instead of some zend zval size things?
The test script doesn't work for me, and the other new_from_buffer-test
script not, too.
> Adding any parameter to the signal_autoconnect() call simply passes that
> data to the callback(s), no change there.
> I'd like to make static GTK calls work in a similar way to this - especially
> main_quit, for obvious reasons! - but that'll take a little more umming and
> ahhing over here... at present there's always an object passed to the
> callback, exactly as if connect() were being called.
A signal_autoconnect_simple doesn't really help as _all_ sigs would be
connected that way. I think that is a pretty hopeless thing; at least if
you can't split the signal handler functions into groups - those which
shall be connected simple, and those not.
--
Regards/MfG,
Christian Weiske