A pull-down menu that can be used within a menubar, a menuitem or any other view.
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 <menuitem>s and <menuseparator>s. 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".
<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>
<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>
<command>, <menuitem>, <menubar>, <menuseparator>, and <floatinglist>
For details on how this component is constructed, see the Menus section of the Component Design Guide.
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| attach | Tag & JS | string | String | bottom | setter |
|
a string to indicate how the floating part of the menu attaches to the menubutton or menuitem. Possible values are: 'top', 'bottom', 'left', and 'right' |
|||||
|
|
|||||
| opened | Tag & JS | expression | any | false | setter |
|
a boolean indicating whether or not the menu is in opened |
|||||
|
|
|||||
doesenter, enabled, hasdefault, isdefault, style, styleable, text
class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes
aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset
| close() | ||
| menu.close() | ||
|
The general method to close a menu starting with itself and then moving 'down' the hierarchy to close all the other menus in the hierarchy. |
||
|
|
| createChildren() | ||
| menu.createChildren(childrenarray) | ||
| Parameters | ||
| Name | Type | Desc |
| childrenarray | None | |
|
|
||
| getTopMenu() | ||
| menu.getTopMenu() | ||
|
finds the top most menu in the heirarchy associated with this menu |
||
|
|
| open() | ||
| menu.open(openit) | ||
|
The general method to open/close a menu starting with itself and then moving 'up' the hierarchy to open/close the other menus in the hierarchy. |
||
| Parameters | ||
| Name | Type | Desc |
| openit | boolean | true opens menu, false closes it |
|
|
||
| setOpen() | ||
| menu.setOpen(isopened) | ||
|
Only Hides and shows the floating list associated with the menu. It does not effect any other part of the menu's heirarchy. to open a menu within a heirarchy use open() instead of setOpen() |
||
| Parameters | ||
| Name | Type | Desc |
| isopened | boolean | true opens menu, false closes it |
|
|
||
doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, setStyle, setTint, updateDefault
animate, applyConstraint, applyData, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption
addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, init, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize
| Events |
onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony
Copyright © 2002-2005 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.