Re: Object Oriented signal handlers?
| From: | Benjamin Smith | Date: | Tue, 28 Jan 2003 00:14:36 +0000 |
| Subject: | Re: Object Oriented signal handlers? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2972@lists.php.net to get a copy of this message | ||
Thanks! Works great!
Saved this tidbit of wisdom here for posterity...
http://gtk.php.net/manual/en/gtk.signals.connection.php
-Ben
On Monday 27 January 2003 11:31 am, you wrote:
> On Mon, 27 Jan 2003, Benjamin Smith wrote:
> > I'm doing a project of medium size, and would like to break out my
> > widgets and signal handlers into objects.
> >
> > I've figured out how to pass around the objects and widgets pretty
> > nicely, but have so far been stumped as to how to call object-oriented
> > signal handlers. Is there a way to do so, or do I just have to use a
> > naming convention (and remember said names, thus fixing my object names)
> > to make this work?
> >
> > For example: (pseudo-code)
> >
> > <?php
> >
> > Class Handle_Login
> > {
> > Function Handle_Login()
> > {
> > $this->Prompt();
> > }
> >
> > Function Prompt() {
> > $this->login_window=&New GtkWindow();
> > // THIS IS WHERE I HAVE TROUBLE - Any ideas?
> > $this->login_window->Connect('destroy', 'this->close',
> > $this->login_window);
>
> How about this?
>
> $window = $this->login_window;
> $window->connect('destroy', array(&$this,'close'), $window);
>
>
> --rdp
>
> Rich Payne
> http://talisman.mv.com
> rdp at talisman dot mv dot com