databinding-$16.lzx
<canvas width="100%" height="150">
<dataset name="stack">
<root/>
</dataset>
<datapointer name="thetop" xpath="stack:/root"/>
<datapointer xpath="stack:/root/*[1]/name()" rerunxpath="true">
<handler name="ondata" args="d">
good_result.setAttribute('text', d)
</handler>
</datapointer>
<datapointer xpath="stack:/root/*[1]/name()">
<handler name="ondata" args="d">
bad_result.setAttribute('text', d)
</handler>
</datapointer>
<simplelayout spacing="5"/>
<text>Type in a string and press the button or the Enter key</text>
<view>
<simplelayout spacing="10" axis="x"/>
<edittext name="input">
<handler name="onkeyup" args="k">
if ( k == 13 ) {
parent.bAdd.handleclick();
}
</handler>
</edittext>
<button name="bAdd" id="ba" text="Push">
<handler name="onclick" method="handleclick"/>
<method name="handleclick" args="ignore">
var n = parent.input.text;
if (thetop.p.childNodes.length == 0) {
thetop.addNode(n)
} else {
var ne = new lz.DataElement(n)
thetop.p.insertBefore(ne, thetop.p.getFirstChild())
}
parent.input.clearText()
</method>
</button>
<button name="bPop" text="Pop">
<handler name="onclick">
var last = thetop.xpathQuery('*[1]')
thetop.p.removeChild(last)
</handler>
</button>
</view>
<view height="100">
<text bgcolor="0xcecece" text="$path{'name()'}">
<datapath xpath="stack:/root/*/name()"/>
</text>
<wrappinglayout axis="y" spacing="3"/>
</view>
<view>
<simplelayout axis="x" spacing="5"/>
<text><b>TOP: </b></text>
<text id="good_result" resize="true" fgcolor="green" fontstyle="bold"/>
<text id="bad_result" resize="true" fgcolor="red" fontstyle="bold"/>
</view>
</canvas>
Cross References
Named Instances