Re: Connecting data
| From: | Scott Mattocks | Date: | Fri, 03 Dec 2004 13:09:48 +0000 |
| Subject: | Re: Connecting data | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5298@lists.php.net to get a copy of this message | ||
Gregory Wild-Smith wrote:
...
function Thing(){ $button = &new GtkButton(); $this->stuff = 0; $button->connect("button-press-event", array($this, "Increment")); $this->stuff = 10; } ...You are passing a copy of the class instance to the connect method. When you put it in the array you are making a copy of it. You need add it to the array by reference. The object that is being used by the call back is not the same object whose stuff value you changed to 10. Its value is still 0. Change your connect line to this: $button->connect('button-press-event', array(&$this, 'Increment')); -- Scott Mattocks scott@crisscott.com http://www.crisscott.com http://pear.php.net/user/scottmattocks