PDA

View Full Version : View target ?


boutinm
08-11-2005, 01:28 PM
How do I target a view from within a class without giving it a id tag?

example:

<class name"box">
<view name="TargetThis" width="30" />
<method event="onclick">
<!-- How do i target the TargetThis view? -->
</method>
</class>

mfrony
08-11-2005, 03:43 PM
Call the view by its name. If you're calling it from inside another view, refer to it by its path.


<canvas>
<class name="box">

<simplelayout axis="y" />

<view name="TargetThis" bgcolor="blue" width="30" height="30" />
<method event="onclick">
<!-- How do i target the TargetThis view? -->
TargetThis.setAttribute("x", "100");
</method>

<!-- call it from inside another view -->
<view name="anotherView">
<button>Change Y
<method event="onclick">
parent.parent.TargetThis.setAttribute("y", 100);
</method>
</button>
</view>
</class>

<box />

</canvas>

boutinm
08-11-2005, 03:51 PM
Thanks! :)