Re: Connection methods

From: Date: Sun, 16 Oct 2005 12:58:27 +0000
Subject: Re: Connection methods
References: 1 2 3 4 5 6 7 8 9  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1831@lists.php.net to get a copy of this message
The one just about everyone uses is $window->connect_object('destroy', array('gtk', 'main_quit')); It'd be confusing (and pointless) if you also passed $window, and it'd get needlessly complicated if you just used a straight connect() call. You'd also use it anywhere you didn't want to pass the initial object but wanted to use one of its signals, and that does arise a fair deal. Sometimes you'll need the signal's parameters to be passed too, sometimes you won't. In event signals it's fairly common to want to do something with $event as well as with your user data (ie other widgets etc), but at present we don't have a way of passing $event without passing the initial object. ----- 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 9:40 PM Subject: Re: [PHP-GTK-DEV] Connection methods > Can you please an example of this? > > -Andrei > > On Oct 14, 2005, at 12:37 PM, Steph wrote: > > > 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().... > >>> > >>> > >> >

« previous php.gtk.dev (#1831) next »