joemcglynn
01-27-2004, 03:26 PM
I have another post asking about how to set the initial value for a combo box. The error I'm getting appears to indicate a bug in baselist.lzx. I stripped out the extra code, the following static example demonstrates the behavior I'm seeing.
If I run this with the debugger on I get the following errors (and no initial value is set for the combo box):
base/baselist.lzx:254: reference to undefined property 'subviews'
base/baselist.lzx:254: undefined object does not have a property 'length'
base/baselist.lzx:254: reference to undefined property 'length'
If I press the button it sets the initial value just fine. Am I missing something or is this a bug? Is there a work-around?
-------code----------
<dataset name="items">
<item value="item1" >item one</item>
<item value="item2" >item two</item>
<item value="item3" >item three</item>
<item value="item4" >item four</item>
</dataset>
<view x="30" y="30">
<simplelayout axis="y"/>
<combobox name="cbox1"
width="130"
defaulttext="choose one...">
<textlistitem datapath="items:/item/" text="$path{'text()'}"
value="$path{'@value'}"/>
<method event="oninit">
selectItem( "item1" );
</method>
</combobox>
<button>Select item with value of "item1"
<method event="onclick">
parent.cbox1.selectItem( "item1" );
</method>
</button>
</view>
</canvas>
If I run this with the debugger on I get the following errors (and no initial value is set for the combo box):
base/baselist.lzx:254: reference to undefined property 'subviews'
base/baselist.lzx:254: undefined object does not have a property 'length'
base/baselist.lzx:254: reference to undefined property 'length'
If I press the button it sets the initial value just fine. Am I missing something or is this a bug? Is there a work-around?
-------code----------
<dataset name="items">
<item value="item1" >item one</item>
<item value="item2" >item two</item>
<item value="item3" >item three</item>
<item value="item4" >item four</item>
</dataset>
<view x="30" y="30">
<simplelayout axis="y"/>
<combobox name="cbox1"
width="130"
defaulttext="choose one...">
<textlistitem datapath="items:/item/" text="$path{'text()'}"
value="$path{'@value'}"/>
<method event="oninit">
selectItem( "item1" );
</method>
</combobox>
<button>Select item with value of "item1"
<method event="onclick">
parent.cbox1.selectItem( "item1" );
</method>
</button>
</view>
</canvas>