Re: Setting an objects method as callback function ?
| From: | Markus Fischer | Date: | Sun, 08 Apr 2001 16:26:41 +0000 |
| Subject: | Re: Setting an objects method as callback function ? | ||
| References: | 1 2 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-1322@lists.php.net to get a copy of this message | ||
On Sun, Apr 08, 2001 at 10:38:14AM -0500, Andrei Zmievski wrote :
> At 02:58 PM 4/8/01 +0200, Markus Fischer wrote:
> >
> >class gtkError extends phpError {
> >
> > var $shutdownFunc;
> >
> > function gtkError() {
> > phpError::phpError();
> >
> > $this->shutdownFunc = 'Gtk::main_quit();';
>
> First of all, this should be array('Gtk', 'main_quit'). That's how you
>
> specify class/object method callbacks.
Fristly, please note : 'Gtk::main_quit();' here works.
When using they array approach here I get
array( 'Gtk', 'main_quit')
main_quit() requires exactly 0 arguments
and
array( 'Gtk', 'main_quit()')
Unable to call signal callback 'gtk::main_quit()'
so writing 'Gtk::main_quit();' is OK.
After all, for User Objects and User Methods you are right
$b = &new GtkButton( 'Exit');
$b->connect( 'clicked', array( $customobject, 'method'));
$b->show();
This work like a charm now !
Like I told on irc, I'm dancing a few times now; Fought my bug
for hours now.
thanks !
Markus
--
Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/
EMail: mfischer@josefine.ben.tuwien.ac.at
PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0