Re: Connection methods
| From: | Steph | Date: | Fri, 14 Oct 2005 19:37:33 +0000 |
| Subject: | Re: Connection methods | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-1825@lists.php.net to get a copy of this message | ||
Yes, because if you want to do something with an object that isn't
responsible for emitting the signal, it makes the code much more readable if
you use connect_object() or something equivalent. Think about
key-press-event signal and such.
We do need connect_replace() then...
Gone!
----- Original Message -----
From: "Andrei Zmievski" <andrei@gravitonic.com>
To: "Steph" <steph@zend.com>
Cc: "PHP DEV" <php-gtk-dev@lists.php.net>; "Scott Mattocks"
<scott@crisscott.com>
Sent: Friday, October 14, 2005 8:29 PM
Subject: Re: [PHP-GTK-DEV] Connection methods
> No, connect_replace() would *not* act like connect_object(). It would
> substitute user-specified object instead of the signal one, e.g.:
>
> $drawarea->connect_object('button_press_event', 'process_object',
> $anotherarea);
>
> function process_object($event, $anotherarea)
> {
> /* note that $anotherarea is passed after event */
> }
>
> $drawarea->connect_replace('button_press_event', 'process_replace',
> $anotherarea);
>
> function process_replace($anotherarea, $event)
> {
> /* note that $anotherarea is passed in place of the signal widget */
> }
>
> And also I'm curious, why do you need connect_object() or
> connect_replace()? Any specific reason?
>
> -Andrei
>
>
> On Oct 14, 2005, at 11:18 AM, Steph wrote:
>
> > No, it's probably me that's confused :) I'm not good when it comes to
> > discussing things theoretically rather than in practical terms.
> >
> > So what are you saying, Andrei - connect_simple() will _only_ pass user
> > data, and connect_replace() will act as connect_object() did?
> >
> > If so we do need connect_replace()....
> >
> >
>