A tree control.
A tree provides a hierarchical view of
data. Each node is represented by an expander resource, an
icon resource, and a label. A tree can be
specified lexically or through data replication
.
Note that a data replicated tree passes its XPath
down to its subtrees, so avoid specifying an XPath
such as "mydataset:/*" or your tree will infinite
loop. Instead, do the following:
Each resource, if specified, should have three states. The expander resource should have an open (frame 1), closed (frame 2), and transparent (frame 3) state. The icon resource should have similar frames. See the default resources in tree as an example.
<canvas width="450" height="250">
<include href="lz/tree.lzx"/>
<dataset name="ancestors">
<hobbit name="Frodo">
<hobbit name="Drogo">
<hobbit name="Fosco" grandparent="true"/>
<hobbit name="Bolger, Ruby" grandparent="true"/>
</hobbit>
<hobbit name="Brandybuck, Primula">
<hobbit name="Brandybuck, Gorbadoc" grandparent="true"/>
<hobbit name="Took, Mirabella" grandparent="true"/>
</hobbit>
</hobbit>
</dataset>
<view x="20" y="20" layout="axis: x; spacing: 10">
<!-- declared tree -->
<view width="200" height="200">
<tree open="true" text="valuemeal">
<tree text="fries" isleaf="true"/>
<tree open="true" text="drink">
<tree text="cola" isleaf="true"/>
</tree>
<tree open="true" text="burger">
<tree text="patty" isleaf="true"/>
<tree text="lettuce" isleaf="true"/>
<tree text="onions" isleaf="true"/>
<tree text="buns" isleaf="true"/>
</tree>
</tree>
</view>
<!-- data replicated tree -->
<view width="200" height="200">
<tree datapath="ancestors:/" icon="null" showroot="false">
<tree datapath="*" icon="null" text="$path{'@name'}"
isleaf="$path{'@grandparent'}"/>
</tree>
</view>
</view>
</canvas>
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| expander | Tag only | string | lztree_arrow_rsc | final | |
|
The resource for the expanding icon: frame 1 (closed), frame 2 (opened), frame 3 (leaf). Default is lztree_arrow_rsc defined in lz/tree.lzx. |
|||||
|
|
|||||
| icon | Tag only | string | lztree_folder_rsc | final | |
|
The resource for the item icon: frame 1 (closed), frame 2 (opened), frame 3 (leaf) Default is lztree_folder_rsc defined in lz/tree.lzx. |
|||||
|
|
|||||
| onactivate | Tag & JS | expression | any | setter | |
|
Double-clicking on the icon or text triggers this event. |
|||||
|
|
|||||
doesenter, enabled, hasdefault, isdefault, style, styleable, text
autoscroll, closechildren, closesiblings, focused, focusoverlay, focusselect, isleaf, multiselect, onfocused, onopen, onselected, open, recurse, selected, showroot, toggleselected, xindent, yindent
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
| toggleOpenAndFocus() | ||
| tree.toggleOpenAndFocus() | ||
|
Focus the tree and toggle open, if this tree is not a leaf and is not being multiselected. |
||
|
|
doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, setStyle, setTint, updateDefault
changeFocus, getChildClass, getChildIndex, getRoot, getSelection, isRoot, keySelect, openChildren
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.