PDA

View Full Version : HELP with attribute


pydyp
02-14-2008, 06:10 AM
Suppose:
<canvas title="myTest" debug="true">
<dataset name="myDataset">
<META>
<FC041 NAME="RED"/>
<FC041 NAME="BLUE"/>
<FC041 NAME="GREEN"/>
</META>
</dataset>
<class name="myClass1" extends="view" width="500" height="200">
<attribute name="myAttr" type="boolean"/>
<simplelayout axis="y"/>
<view width="100%" height="20" datapath="myDataset:/META/FC041">
<edittext datapath="@NAME" visible="${classroot.myAttr}"/>
</view>
</class>
<class name="myClass2" extends="view" width="500" height="200">
<attribute name="myAttr" type="boolean"/>
<simplelayout axis="y"/>
<replicator dataset="myDataset" xpath="/META/FC041">
<view width="100%" height="20">
<edittext datapath="@NAME" visible="${classroot.myAttr}"/>
</view>
</replicator>
</class>
<myClass1 y="0" myAttr="true"/>
<myClass2 y="200" myAttr="true"/>
</canvas>

for myClass1, it works fine.
for myClass2, I have this message: WARNING @test.lzx#21: reference to undefined property 'myAttr'
I need to use the Class2 (explicite replication).
I dont know what to do.
Could someone help me please.
Thanks

rcyeager
02-14-2008, 07:32 AM
The following is a workaround:


<canvas title="myTest" debug="true">
<dataset name="myDataset">
<META>
<FC041 NAME="RED"/>
<FC041 NAME="BLUE"/>
<FC041 NAME="GREEN"/>
</META>
</dataset>
<class name="myClass1" extends="view" width="500" height="200">
<attribute name="myAttr" type="boolean"/>
<simplelayout axis="y"/>
<view width="100%" height="20" datapath="myDataset:/META/FC041">
<edittext datapath="@NAME" visible="${classroot.myAttr}"/>
</view>
</class>
<class name="myClass2" extends="view" width="500" height="200">
<attribute name="myAttr" type="boolean"/>
<simplelayout axis="y"/>
<replicator dataset="myDataset" xpath="/META/FC041">
<view width="100%" height="20">
<edittext datapath="@NAME" visible="${parent.parent.myAttr}"/>
</view>
</replicator>
</class>
<myClass1 y="0" myAttr="true"/>
<myClass2 y="200" myAttr="true"/>
</canvas>


See how I changed classroot to parent.parent for the explicit replication case? May be a defect, as without the change classroot points to the canvas.

Robert
http://www.qrowd.com
http://www.cooqy.com

senshi
02-14-2008, 08:52 AM
May be a defect, as without the change classroot points to the canvas.

Yep, created LPP-5434 (http://www.openlaszlo.org/jira/browse/LPP-5434) to fix this bug.