PDA

View Full Version : dataset based menu menutiems


hunterino
07-09-2005, 11:14 AM
hello,
I am building a menu that is based on xml. The non xml version works like I want, but the xml one gives errors that the setOpen method doesn't exist. Also events like onmouseout do not get called.

Here is the code

<canvas width="640" height="480" debug="true">
<dataset name="xmlmenu">
<menubar>
<menu text="Healthy Eating">
<menuitem text="A" url="1.html" />
<menuitem text="B" url="2.html" />
<menuitem text="C" url="3.html" />
</menu>
<menu text="Other">
<menuitem text="A" url="1.html" />
<menuitem text="B" url="2.html" />
<menuitem text="C" url="3.html" />
</menu>
</menubar>
</dataset>

<!-- this is the test case that works -->
<view name="xmlmenuview" width="75" height="20" bgcolor="blue">
<text>menu</text>
<menu name="topmenu" attach="bottom" onmouseout="debug.write('Out');">
<method event="onmouseout">debug.write("Out");</method>
<menuitem text="item 1">
<attribute name="theurl" type="string" value="yes you can"/>
<method event="onselect">
url = this.getAttribute('theurl');
debug.write("url:"+ url);
</method>
</menuitem>
<menuitem text="item 2" onselect="debug.write(this.text);"/>
</menu>
<method event="onmouseover">this.topmenu.setOpen(true);</method>
</view>

<!-- this is the test case that doesn't work -->
<text>MenuXML</text>
<view layout="axis: x">
<view name="replXML" datapath="xmlmenu:/menubar/menu/"
layout="axis: x" bgcolor="blue">
<text datapath="@text" align="center" />
<menu name="tmenu" id="topme" datapath="menuitem/" attach="bottom">
<menuitem name="submenu" text="$path{'@text'}">
<attribute name="theurl" value="$path{'@url'}" />
<method event="onselect">
url = this.getAttribute('theurl');
lzBrowser.loadJS(url);
</method>
</menuitem>
</menu>
<view width="3" height="100%" bgcolor="white" />
<method event="onmouseover">
<!-- the error is here -->
<!-- || -->
<!-- \/ -->
this.tmenu.setOpen(true);
</method>
</view>
</view>
<simplelayout axis="y"></simplelayout>

</canvas>

Is there a better way to do this?

Thanks
Michael