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
".
Example 59. 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.debug("%w - %w", vThis.parent.owner.text, vThis.text);
</method
>
</canvas
>
Example 60. 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
>
Name (CSS property) | Type (tag) | Type (js) | Default | Category |
---|---|---|---|---|
attach
|
string | String | bottom | read/write |
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
|
boolean | boolean | false | read/write |
a boolean indicating whether or not the menu is in opened | ||||
text
|
html | lz.html | menutitle | read/write |
the test that appears in the menu button if the menu is a subview of a menubar |
doesenter, enabled, hasdefault, isdefault, style, styleable, text
aaactive, aadescription, aaname, aasilent, aatabindex, align, backgroundrepeat, bgcolor, cachebitmap, capabilities, clickable, clickregion, clip, colortransform, context, contextmenu, cornerradius, cursor, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hasdirectionallayout, hassetheight, hassetwidth, height, layout, loadratio, mask, opacity, pixellock, playing, proxyurl, resource, resourceheight, resourcewidth, rotation, shadowangle, shadowblurradius, shadowcolor, shadowdistance, showhandcursor, source, stretches, subviews, tintcolor, totalframes, unstretchedheight, unstretchedwidth, usegetbounds, valign, visibility, visible, width, x, xoffset, xscale, y, yoffset, yscale
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
close() |
---|
getTopMenu() |
---|
open() |
---|
setOpen() |
---|
acceptValue, doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, presentValue, setStyle, setTint, updateDefault
bringToFront, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getCurrentTime, getDepthList, getDisplayObject, getID3, getMouse, getNextSelection, getPan, getPrevSelection, getProxyURL, getTotalTime, getVolume, init, isBehind, isInFrontOf, isMouseOver, measureHeight, measureWidth, play, proxyurl, searchSubviews, seek, sendAAEvent, sendBehind, sendInFrontOf, sendToBack, setAccessible, setAttributeRelative, setColor, setColorTransform, setPan, setProxyPolicy, setSource, setVolume, shouldYieldFocus, stop, unload, updateResourceSize
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
Events
onaddsubview, onbackgroundrepeat, onblur, onclick, onclickable, onclip, oncontext, oncornerradius, ondblclick, onerror, onfocus, onframe, onframesloadratio, ongesture, onheight, onkeydown, onkeyup, onlastframe, onload, onloadratio, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmousetrackout, onmousetrackover, onmousetrackup, onmouseup, onmouseupoutside, onopacity, onplay, onplaying, onremovesubview, onshadowangle, onshadowblurradius, onshadowcolor, onshadowdistance, onstop, ontimeout, ontouch, onvisible, onwidth, onx, ony
Copyright © 2002-2010 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.