The menu tag creates a menu that floats above
all other views when activated. If a menu is a subview of a
menubar, then it will create a
"menubutton" in the menubar with the its
text attribute equal to that of the menu's. This "menubutton"
inherits its properties from button.
typical use of a menu is shown below, with its children of menuitems and menuseparators. Note, however, that the parent
of a menuitem is not the menu itself, but rather a floatinglist that is implicity part of the menu.
To access the menu from a menuitem (or any other subview) use the
reference "parent.owner".
Example 46. using the menubar
<canvas debug="true" height="230">
<debug y="100"/>
<menubar width="200" >
<menu text="Menu 1" width="100">
<menuitem text="Item 1" onselect="canvas.whichOne(this);"/>
<menuitem text="Item 2" onselect="canvas.whichOne(this);"/>
<menuitem text="Item 3" onselect="canvas.whichOne(this);"/>
<menuseparator/>
<menuitem text="Item 4" onselect="canvas.whichOne(this);"/>
</menu>
<menu text="Menu 2" width="100">
<menuitem text="More items..." onselect="canvas.whichOne(this);"/>
</menu>
</menubar>
<method name="whichOne" args="vThis">
Debug.write(vThis.parent.owner.text + " - "+ vThis.text);
</method>
</canvas>
Example 47. simple menu
<canvas debug="true" height="235">
<debug y="105"/>
<button text="openMenu below">
<menu name="topmenu" attach="bottom">
<menuitem text="item 1"/>
<menuitem text="item 2">
<menu name="submenu">
<menuitem text="subitem 1"/>
<menuitem text="subitem 2"/>
</menu>
</menuitem>
</menu>
<handler name="onmousedown">
this.topmenu.setOpen(true);
</handler>
</button>
</canvas>
Copyright © 2002-2007 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.