Re[2]: [PHP-GTK] Connecting data
| From: | Tom Rogers | Date: | Fri, 03 Dec 2004 23:20:55 +0000 |
| Subject: | Re[2]: [PHP-GTK] Connecting data | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5304@lists.php.net to get a copy of this message | ||
Hi,
Saturday, December 4, 2004, 7:11:53 AM, you wrote:
GWS> Interesting... well certainly a lot to think about!
GWS> I didn't realise the callback was passed as a copy, that does make the
GWS> behavior make more sense. However I've never encountered this behavior in
GWS> PHP before. Perhaps that's just me. It is however very anoying ;) Why will
GWS> php-gtk2 not do this?
GWS> Thanks for all the suggestions however. One thing I will ask - there was
GWS> talk of &$this being unstable with events.. in what way? I too code for
GWS> windows (with a view to moving eventually most of the backend code to a web
GWS> app, but thats about 2 years down the line), so it would be useful to know.
GWS> - Greg
In my case as one example, I have a file manager class which keeps a list of
drives on my computer and generates a drive class for each drive letter. In the
manager class I had a $current_drive variable which was used by virtually every
event function. It just proved impossible to keep that variable visible to all
event functions. Some would see the correct value and others would see its
default value yet they were all setup in the same manner with
array(&this,function_name). By storing current_drive in a GtkVBox the problem
was solved. The whole file manager was built into the VBox so it was a constant
for the class.
--
regards,
Tom