Re: $menu->append( &new GtkMenuItem) can't be written that way ?

From: Date: Mon, 09 Apr 2001 22:38:14 +0000
Subject: Re: $menu->append( &new GtkMenuItem) can't be written that way ?
References: 1 2 3  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-1332@lists.php.net to get a copy of this message
On Tue, Apr 10, 2001 at 12:07:00AM +0200, Markus Fischer wrote : > On Mon, Apr 09, 2001 at 04:37:37PM -0500, Andrei Zmievski wrote : > > On Mon, 09 Apr 2001, Markus Fischer wrote: > > > $menu = &new GtkMenu(); > > > foreach( $menuitems as $menuitem) > > > $menu->append( &new GtkMenuItem( $menuitem)); > > > > > > does not work, getting parse error in the 3rd line: > > > > > > parse error, expecting T_VARIABLE' or > > > '$'' > > > > > > Instead it must be writte this way : > > > > > > $menu = &new GtkMenu(); > > > foreach( $menuitems as $menuitem) { > > > $tmp = &new GtkMenuItem( $menuitem); > > > $menu->append( $tmp); > > > } > > > > Just do this: > > > > $menu->append(new GtkMenuItem($menuItem)); > > > > &new works only for assignments. > > When I just use the short syntax like you wrote, I'm only > getting the first menu entry to be dislpayed when the menu ( > actually its an optionslist, but they use menus) is inactive > (i.e. no user interaction). When I activate it, then the menu is > empty and there is no Item I can choose from. Ah, ok. Stupid myself, I apologize wasting time. Of course $menu->append( new GtkMenuItem( $menuitem)); works. But this way this leaves out something very important -> setting the objects visibility. Argl. Anyway, why do I need the $var = &new Object; only on assignments and not when passing parameters ? thx, markus

« previous php.gtk (#1332) next »