PDA

View Full Version : subviews


productengine
10-15-2003, 12:12 AM
Hi!
How to determinate has some view any subviews? I found getDepthList() method in LZX Reference. Is there some other possibility?

antun
10-15-2003, 11:12 AM
Each view has a subviews array of its children. Here's an example:


<canvas debug="true">
<debug x="200" />

<simplelayout axis="y" spacing="10" />

<class name="red_view" bgcolor="red" width="200" height="20" />

<view name="foo">
<simplelayout axis="y" spacing="1" />
<red_view name="grumpy" />
<red_view name="dopey" />
<red_view name="happy" />
</view>

<button>
<method event="onclick">
<![CDATA[
var foosKids = foo.subviews;
for (var i=0; i< foosKids.length; i++) {
debug.write( foosKids[i].name );
}
]]>
</method>
</button>
</canvas>

Holomatrix
07-10-2005, 01:49 PM
How can I identify a subview in the array, I mean so that I can get the position of the subview in the array?

Regards,
Ingo

Holomatrix
07-10-2005, 02:08 PM
for(var i=0; i &lt; view.subviews.length; i++){
if(classroot.ident == view.subviews[i].ident){ Debug.write("subview: " + (i+1));
}
}

That way!