PDA

View Full Version : how to access the attribute of view1 from view2


d_ivp
11-15-2006, 05:14 AM
hi
i m new to laszlo..i m tryin to change the value of visible attribute of 1 view from another view when we click on this view.. is it posible pls guid me...
thanx in advance

frisco
11-15-2006, 11:07 AM
hi
change the value of visible attribute of 1 view from another view when we click on this view

<canvas>

<simplelayout axis="x" spacing="10"/>

<view name="foo" height="75" width="75" bgcolor="0xFF0000"
onclick="bar.setAttribute('bgcolor', 0x0000FF)">
<text fontstyle="bold" text="Click me"/>
</view>

<view name="bar" height="75" width="75" bgcolor="0xFF0000"/>

</canvas>

As an LZunit test case:

<canvas debug="true">
<include href="lzunit"/>

<script>
asynchronousTests = true;
</script>

<simplelayout axis="x" spacing="10"/>

<view name="foo" height="75" width="75" bgcolor="0xFF0000"
onclick="bar.setAttribute('bgcolor', 0x0000FF)">
<text fontstyle="bold" text="Click me"/>
</view>

<view name="bar" height="75" width="75" bgcolor="0xFF0000"/>

<TestSuite>
<TestCase>

<method name="testBeforeClick" event="oninit">
assertEquals(bar.bgcolor, 0xFF0000);
</method>

<method name="afterClick" event="onclick">
assertEquals(bar.bgcolor, 0x0000FF);
</method>

</TestCase>
</TestSuite>

</canvas>

<!-- Copyright 2001-2006 Laszlo Systems, Inc. -->