Re: $menu->append( &new GtkMenuItem) can't be written that way ?
| From: | Markus Fischer | Date: | Mon, 09 Apr 2001 22:07:00 +0000 |
| Subject: | Re: $menu->append( &new GtkMenuItem) can't be written that way ? | ||
| References: | 1 2 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-1331@lists.php.net to get a copy of this message | ||
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.
kind regards,
Markus