I have a class that extends window and uses two states to maximize and
minimize windows using animatorgroups. I need to pass variables to both an x
animator and y animator in the minimize animatorgroup. Nothing has worked,
and this also affects the maximize animatorgroup. I have tried the following
without success:
parent.variable
parent.parent.variable
classinstance.variable
classinstance.method()
The code follows. Any ideas are greatly appreciated.
Gary T. Schultz
Wisconsin Department of Commerce
================= Code =================
<?xml version="1.0" encoding="UTF-8" ?>
<library>
<tabslider width="${canvas.width*.22}" x="10" y="20" height="200"
spacing="2" slideduration="300">
<tabelement name="one" text="Tabelement One" />
<tabelement name="two" text="Tabelement Two" />
<tabelement name="three" text="Tabelement Three">
<text text="${gts[1].myX}" />
</tabelement>
</tabslider>
<class extends="window" name="myClass" width="${(canvas.width*.25)}"
height="${size}" allowdrag="false" showhandcursor="false"
haswindowfocus="true">
<attribute name="myX" value=".25" />
<attribute name="size" value="${(canvas.height*.30)}" />
<state name="max" apply="false">
<animatorgroup duration="2000" process="simultaneous">
<animator attribute="width" to="${(canvas.width*.35)}" />
<animator attribute="height"
to="${(canvas.height*.40)}" />
<animator attribute="x" to="${canvas.width*.5}" />
<animator attribute="y" to="${canvas.height*.5}" />
</animatorgroup>
<text align="center" y="20%">M a x i m i z e d</text>
<button placement="title_area" align="right" height="16">
<attribute name="isMax" value="true" />
<handler name="onclick">
if (this.isMax) { parent.max.remove();
parent.min.apply(); } else { parent.max.apply();
parent.min.remove(); } this.isMax = !this.isMax;
</handler>
<attribute name="text" value="Minimize Window" />
</button>
</state>
<state name="min" apply="true">
<animatorgroup duration="2000" process="simultaneous">
<animator attribute="width" to="${(canvas.width*.25)}" />
<animator attribute="height"
to="${(canvas.height*.30)}" />
<!-- ************* NEED TO PASS VARIABLES HERE. SO FAR NOTHING WORKS
************* -->
<animator attribute="x" to="${canvas.width*myClass.myX}" />
<animator attribute="y" to="${(canvas.height*myClass.myY)+18}" />
</animatorgroup>
<!-- ************* PASSING VARIABLES HERE WORKED ************* -->
<text align="center" valign="middle"
text="${parent.myX+' '+parent.myY}">
</text>
<button placement="title_area" align="right" height="16">
<attribute name="isMax" value="false" />
<handler name="onclick">
if (this.isMax) { parent.max.remove();
parent.min.apply(); } else { parent.max.apply();
parent.min.remove(); } this.isMax = !this.isMax;
</handler>
<attribute name="text" value="Maximize Window" />
</button>
</state>
</class>
<myClass myY="0" title="Window">
<method name="myX">return .25;</method>
<text>Window 1</text>
</myClass>
<myClass myX=".50" myY="0">
<text>Window 2</text>
</myClass>
<myClass myX=".75" myY="0">
<text>Window 3</text>
</myClass>
<myClass myX=".25" myY=".30">
<text>Window 4</text>
</myClass>
<myClass myX=".50" myY=".30">
<text>Window 5</text>
</myClass>
<myClass myX=".75" myY=".30">
<text>Window 6</text>
</myClass>
<myClass myX=".25" myY=".60">
<text>Window 4</text>
</myClass>
<myClass myX=".50" myY=".60">
<text>Window 5</text>
</myClass>
<myClass myX=".75" myY=".60">
<text>Window 6</text>
</myClass>
</library>