An item in a pull-down menu.
The <menuitem> tag provides a menu item within the
<menu> tag. To associate a set of key commands with
a <menuitem>, create a LzCommand
object with an execution script
(onselect="expression"), and then set the
command attribute of the
<menuitem> equal to the reference of that
LzCommand object.
Note: Menus do not adjust their widths to the width of their widest
menuitem, so the width of the menu needs to be
set directly (its default width is 100 pixels). This is especially
important with LzCommand, since the text
associated with a comand is right justified and will overlay the text
of the menuitem if the width of the menu is not
large enough.
<canvas width="350" height="270" debug="true">
<debug x="5" y="140"/>
<command id="cmd_new"
onselect="Debug.write('EXECUTED command new')"
key="['Control', 'Shift', 'N']"/>
<menubar width="200">
<menu text="Menu 1" width="160">
<menuitem text="New..." onselect="canvas.whichOne(this);" command="cmd_new"/>
<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>
menu, menubar, menuseparator, and LzCommand
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| command | Tag & JS | expression | any | setter | |
|
the command object assigned to be executed when this menuitem is selected |
|||||
|
|
|||||
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
| setCommand() | ||
| menuitem.setCommand(cmd) | ||
|
call this method to set the command associated with a menuitem |
||
| Parameters | ||
| Name | Type | Desc |
| cmd | Command | |
|
|
||
| setHilite() | ||
| menuitem.setHilite(ishilite) | ||
|
Called automatically by the menu. The default action uses the colors defined in a styles object to change the colors of the background and text. |
||
| Parameters | ||
| Name | Type | Desc |
| ishilite | boolean | true shows hilite and false restores it back |
|
|
||
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.