PDA

View Full Version : conditional tag?


avanloov
04-24-2006, 11:28 AM
I am trying to create a declarative (tag) way of conditionally including objects/instances. Something akin to the "logic" taglibs in JSP...

<canvas height="450" width="700" debug="true">
<class name="conditional" defaultplacement="iAmTrue">
<attribute name="verity" type="boolean" />
<simplelayout/>
<state name="iAmTrue" />
<state name="iAmFalse" />
<method event="oninit">
if (verity)
iAmTrue.apply();
else
iAmFalse.apply();
</method>
</class>

<simplelayout />
<conditional verity="true">
<text bgcolor="green" text="TRUE" />
<text bgcolor="red" text="FALSE" placement="iAmFalse"/>
</conditional>
<conditional verity="false">
<text bgcolor="green" text="TRUE" />
<text bgcolor="red" text="FALSE" placement="iAmFalse"/>
</conditional>
</canvas>

Unfortunately, I get the error:

"Cannot apply mask before resource has been attached in «LzText#0| LzText: undefined»"

I tried 'apply="true"' for both states and remove() on the one that is inappropriate, but that also did not work. Even put named views inside the state tags, but I couldn't get the text tags to attach to them either.

Searching for previoius coverage of this issue, I read this post:
http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=3421
I don't think he got an answer.

-Andre