jshood
11-10-2004, 10:46 AM
I am attempting to contstrain something to a parents attribute. Below is some sample code I've put together to illustrate.
The myScreen view contains an attribute called boxVisible. The "myModule" class contains a view that should be visible when it's boxVisible attribute is set to true. Becuase the myModule object can be replicated and placed an arbitrary depth away from myScreen I am attempting to contstrain the value of boxVisible, to the value I pass in.
Any thoughts are appreciated.
-Jeff
<canvas>
<class name="myModule">
<attribute name="boxVisible" type="string" />
<simplelayout axis="y" />
<edittext name="myEdit" >Some Text Could Go Here</edittext>
<text>Some More Text Goes Here</text>
<view name="myBox"
height="${parent.height}"
width="${parent.width}"
x="1"
y="1"
visible="${parent.boxVisible}"
bgcolor="red"
/>
</class>
<view name="myScreen" width="200" height="200">
<attribute name="boxVisible" type="string" value="false" />
<simplelayout axis="y"/>
<button name="btnView" text="Make Box Visible">
<method event="onclick">
this.parent.setAttribute('boxVisible',!this.parent .boxVisible);
debug.write('Box Visible is:'+parent.boxVisible);
</method>
</button>
<myModule name="boxMod" boxVisible="${this.parent.getAttribute('boxVisible')}" />
</view>
</canvas>
The myScreen view contains an attribute called boxVisible. The "myModule" class contains a view that should be visible when it's boxVisible attribute is set to true. Becuase the myModule object can be replicated and placed an arbitrary depth away from myScreen I am attempting to contstrain the value of boxVisible, to the value I pass in.
Any thoughts are appreciated.
-Jeff
<canvas>
<class name="myModule">
<attribute name="boxVisible" type="string" />
<simplelayout axis="y" />
<edittext name="myEdit" >Some Text Could Go Here</edittext>
<text>Some More Text Goes Here</text>
<view name="myBox"
height="${parent.height}"
width="${parent.width}"
x="1"
y="1"
visible="${parent.boxVisible}"
bgcolor="red"
/>
</class>
<view name="myScreen" width="200" height="200">
<attribute name="boxVisible" type="string" value="false" />
<simplelayout axis="y"/>
<button name="btnView" text="Make Box Visible">
<method event="onclick">
this.parent.setAttribute('boxVisible',!this.parent .boxVisible);
debug.write('Box Visible is:'+parent.boxVisible);
</method>
</button>
<myModule name="boxMod" boxVisible="${this.parent.getAttribute('boxVisible')}" />
</view>
</canvas>