Re: GladeXML: signal_autoconnect to an object?
| From: | Steph Fox | Date: | Mon, 24 Oct 2005 18:44:17 +0000 |
| Subject: | Re: GladeXML: signal_autoconnect to an object? | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-1921@lists.php.net to get a copy of this message | ||
OK, I can see how to do it I think (looking at Zend API), but you'd need to
change your handler name within the Glade file, not within PHP.
----- Original Message -----
From: "Steph Fox" <steph@zend.com>
To: "Christian Weiske" <cweiske@cweiske.de>
Sent: Monday, October 24, 2005 7:32 PM
Subject: Re: [PHP-GTK-DEV] GladeXML: signal_autoconnect to an object?
> hrrrrrrrrmm... passing an object as a parameter works in the sense that
> signal->autoconnect($button) would pass $button to each callback function,
> not in the sense that $button would be the object 'owning' the callback,
so
> there's a syntactic error in that concept, although obviously:
>
> $glade->signal_connect('btnClicked', array($this, 'btnClicked'));
>
> would work.
>
> I'll look into it... I can see how it would be useful.
>
>
> ----- Original Message -----
> From: "Christian Weiske" <cweiske@cweiske.de>
> To: "Steph Fox" <steph@zend.com>
> Sent: Monday, October 24, 2005 6:39 PM
> Subject: Re: [PHP-GTK-DEV] GladeXML: signal_autoconnect to an object?
>
>
> > Steph,
> >
> > > Sample pseudocode?
> > Assume I have a glade file with a button, and that button's "clicked"
> > signal has been connected to the "btnClicked" function.
> > Now when doing a $glade->signal_autoconnect(), I have to have the
> > following code:
> >
> > <?php
> > $glade = null;//load glade here
> > $glade->signal_autoconnect();
> >
> > function btnClicked()
> > {
> > echo "button has been clicked";
> > }
> > ?>
> >
> >
> > However, I want to be able to do the following:
> > <?php
> > class MyApp
> > {
> > function init() {
> > $glade = null;//load glade here
> > $glade->signal_autoconnect($this);
> >
> > }
> >
> > function btnClicked()
> > {
> > echo "button has been clicked";
> > }
> > }
> > $app = new MyApp();
> > $app->init();
> > ?>
> >
> >
> > --
> > Regards/MfG,
> > Christian Weiske
>