PDA

View Full Version : changing layout dynamically


whisperstorm
12-08-2003, 01:46 PM
I want to change the spacing in a layout dynamically based on clicking a child view - how do I access the layout element to change it?

Say I had a view with spacing of 10 and I wanted a child view when I clicked on it to change the spacing to 20...

antun
12-08-2003, 01:54 PM
Good question. I fiddled with it a bit and discovered I could achieve what you wanted using a state:


<canvas debug="true">
<class name="bluebox" width="200" height="20" bgcolor="blue" />

<simplelayout axis="y" spacing="5" />
<button>Change spacing
<method event="onclick">
foo.five.remove();
foo.twenty.apply();
</method>
</button>

<view name="foo">
<state name="five" apply="true">
<simplelayout axis="y" spacing="5" />
</state>
<state name="twenty" apply="false">
<simplelayout axis="y" spacing="20" />
</state>
<bluebox />
<bluebox />
<bluebox />
<bluebox />
<bluebox />
<bluebox />
<bluebox />
<bluebox />
</view>
</canvas>


I'm not sure if this will always work for every kind of layout though...

-Antun

whisperstorm
12-08-2003, 02:19 PM
actually - I found using your "animating layouts" tip of the week to be very useful:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=401