Hi there,
I am having a problem with the class 'tree'. In the code below, I create a
list. When an entry in the list is clicked, it creates an instance of 'tree'.
But the list clicking does not work properly. For instance, click the first
entry, then use the scroll bar to scroll the list to the end of the list and
then click the last entry, the list somehow jumps back to the last entry of the
shown items before scrolling. Try to select an entry, use the scroll bar to
make the selected entry unseen, and then select another entry, you should see
the problems. But note that if I do not scroll the list, everything works
perfectly.
If I create a push button instead of a tree node when an entry is clicked,
everything works just fine (i.e., uncomment Line 11 and comment out Line 10 in
the code below).
Your help is greatly appreciated!
Chen Ding
1 <canvas>
2 <class name="mytree" extends="tree"/>
3 <class name="mybutton" extends="button"/>
4
5 <view x="500" y="100" width="500" height="300" name="the_view">
6 <attribute name="widget" type="expression"/>
7
8 <method name="showContents" args="name">
9 if (this['widget']) this.widget.destroy();
10 this.widget = new lz.mytree(this, { text : name }, []);
11 // this.widget = new lz.mybutton(this, { text : name }, []);
12 </method>
13 </view>
14
15 <class name="mytextlistitem" extends="textlistitem">
16 <handler name="onclick">
17 the_view.showContents(text);
18 </handler>
19 </class>
20
21 <view name="mylist" width="400" height="250">
22 <handler name="oninit">
23 this.list_field.createItems();
24 </handler>
25
26 <list name="list_field"
27 width="${parent.width}"
28 x="0"
29 spacing="2"
30 shownitems="6"
31 toggleselected="true"
32 bgcolor="${iceblue4}">
33
34 <selectionmanager name="selector" toggle="true"/>
35
36 <method name="createItems">
37 <![CDATA[
38 for (var i=0; i<20; i++)
39 {
40 var entry = new lz.mytextlistitem(this,
41 {
42 width : this.width,
43 height : 30,
44 text : 'Object_' + i
45 }, []);
46 }
47 ]]>
48 </method>
49 </list>
50 </view>
51 </canvas>
_________________________________________________________________
Get more from your digital life. Find out how.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008