sulletf
09-25-2007, 12:40 AM
Hi!
this code is, to me, working strangely : I would have expected it switch from horizontal to vertical display.
What do you think ?
<canvas>
<dataset name="obj">
<objects>
<object id="1" image="image1.jpg"/>
<object id="2" image="image2.jpg"/>
</objects>
</dataset>
<simplelayout>
<handler name="oninit">
canvas.t.setText('axis is ' + this.getAttribute('axis'));
</handler>
<handler name="onclick" reference="canvas.b">
if (canvas.b.getAttribute('text') == 'to axis X') {
this.setAttribute('axis','x');
canvas.b.setAttribute('text','to axis Y');
}
else {
this.setAttribute('axis','y');
canvas.b.setAttribute('text','to axis X');
}
this.update;
canvas.t.setText('axis is ' + this.getAttribute('axis'));
</handler>
</simplelayout>
<text name="t">
</text>
<button name="b" text="to axis X"/>
<view name="v" datapath="obj:/objects/object">
<simplelayout axis="x" />
<text datapath="@id" />
<text datapath="@image" />
</view>
</canvas>
this code is, to me, working strangely : I would have expected it switch from horizontal to vertical display.
What do you think ?
<canvas>
<dataset name="obj">
<objects>
<object id="1" image="image1.jpg"/>
<object id="2" image="image2.jpg"/>
</objects>
</dataset>
<simplelayout>
<handler name="oninit">
canvas.t.setText('axis is ' + this.getAttribute('axis'));
</handler>
<handler name="onclick" reference="canvas.b">
if (canvas.b.getAttribute('text') == 'to axis X') {
this.setAttribute('axis','x');
canvas.b.setAttribute('text','to axis Y');
}
else {
this.setAttribute('axis','y');
canvas.b.setAttribute('text','to axis X');
}
this.update;
canvas.t.setText('axis is ' + this.getAttribute('axis'));
</handler>
</simplelayout>
<text name="t">
</text>
<button name="b" text="to axis X"/>
<view name="v" datapath="obj:/objects/object">
<simplelayout axis="x" />
<text datapath="@id" />
<text datapath="@image" />
</view>
</canvas>