John, there is a difference between setting the value of the axis  
under control, or the value of the opposite axis. In your example  
below, you set the y attribute of the first view, but the  
simplelayout is controlling the y attribute so the original value is  
overwritten. If you were to instead set the x attribute of that view  
to 30, you would see that the blue view would be initially placed at  
(30, 0).

If you want to affect where the simplelayout begins its layout, you  
can set the inset attribute. Here's an example that shows both:

<canvas  debug="true">
    <view >
      <simplelayout axis="y" spacing="10" inset="15"/>
      <view bgcolor="blue" y="40" height="30" width="50">
        <handler name="onconstruct">
          Debug.monitor(this, 'x');
          Debug.monitor(this, 'y');
        </handler>
      </view>
      <view bgcolor="yellow" x="15" height="30" width="50"/>
      <view bgcolor="green" height="30" width="50"/>
    </view>
</canvas>

Note that the blue view is drawn at y=15, not y=30, and the yellow  
view is drawn at x=15, not x=0.

jim

On Jun 19, 2006, at 2:12 PM, John Sundman wrote:

> Well, I am now officially confused about the behavior of simplelayout
> (and not for the first time).
>
> This is what I have written in the reference page now:
>
> <p><classname>simplelayout</classname> extends
> <classname>LzLayout</classname>, and therefore it is responsible for
> arranging all of the subviews for the view that it is attached to.
> <classname>simplelayout</classname>
> affects either the <attribute>x</attribute> or <attribute>y</ 
> attribute>
> value, depending on the value of the <attribute>axis</attribute>
> attribute. <classname>simplelayout</classname> places the first  
> subview
> at (0, 0) and then places each subsequent subview based on the width
> (or height) of the previous subview, depending on which axis was
> specified.</p>
>
> However, consider the following:
>
> <canvas  debug="true">
>    <view >
>      <simplelayout axis="y" spacing="10"/>
>      <view bgcolor="blue" y="40" height="30" width="50">
>          <handler name="oninit">
>             Debug.write("x is " + x, "y is " + y)
>          </handler>
>      </view>
>      <view bgcolor="blue" height="30" width="50"/>
>      <view bgcolor="blue" height="30" width="50"/>
>    </view>
> </canvas>
>
> No matter what values you assign to x and y of the first view, it
> always appears in the upper left corner.  That is, to the eye it
> appears that it's at x=0, y=0.
>
> However, the debug statements reflect the values given to x and y in
> the opening tag.
>
> So the question comes down to, who am I going to believe, the debug
> statement or my lying eyes?
>
> Or, more likely, am I overlooking something really obvious?
>
> Thanks
>
> jrs
>
> _______________________________________________
> Laszlo-dev mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to