Re: use of = &new object versus = new object
| From: | Jake Gordon | Date: | Mon, 11 Jul 2005 20:32:12 +0000 |
| Subject: | Re: use of = &new object versus = new object | ||
| References: | 1 2 3 4 5 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5983@lists.php.net to get a copy of this message | ||
Thanks for all the replies. Still a bit confused though!
Andrei Zmievski wrote:
Trust me, you need to use &new in PHP-GTK 1. You may not see any problems right away, but they will crop up.But the funny thing is, with some code I had trouble with before I found that dropping the & was the only way to get it to work. Probably more to do with poor coding on my part though, but it took me three hours to solve the damn problem and that's how I solved/hacked it. This was, I think, the code: --- $button->connect('clicked', 'change_main', $section); function change_main($button, $section, $main) {
global $layout, $main;
// First destroy what was here before, if anything
if($main) $main->destroy();
$main = &new GtkLabel($section); // remove & to work
$layout->put($main,100,40);
$main->show();
}
---
Jake.