But shouldn't it still work with parent.x+5 anyway?

Not quite. parent.x refers to the parent's x position relative to the canvas. In your example, the first red view has an x of 0 in the canvas. The interior view is constrained to have an x of parent.x + 5, which works out to 5 in this case. The second red view has an x of 100 relative to the canvas. The interior view therefore has an x of 105. Since it is being place 105 pixels from the left of the second red view, the views are not working as desired. Here's a modified version:

<canvas width="600" height="400">

    <simplelayout axis="x"/>

    <view name="first"
          bgcolor="red" width="100" height="100">
        <view bgcolor="black"
width="${ parent.width - 10 }" height="${ parent.height - 10 }"
              x="5" y="5"/>
    </view>

    <view name="second"
          bgcolor="red" width="100" height="100">
        <view bgcolor="black"
width="${ parent.width - 10 }" height="${ parent.height - 10 }"
              x="5" y="5"/>
    </view>

</canvas>

<canvas width="600" height="400">
  <simplelayout axis="x"/>

  <view bgcolor="red" width="100" height="100">
    <view bgcolor="black"
          width="${parent.width-10}"
          height="${parent.height-10}"
          x="${parent.x+5}"
          y="${parent.y+5}"/>
  </view>

  <view bgcolor="red" width="100" height="100">
    <view bgcolor="black"
          width="${parent.width-10}"
          height="${parent.height-10}"
          x="${parent.x+5}"
          y="${parent.y+5}"/>
  </view>

</canvas>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user


Dan Stowell
Software Engineer
Laszlo Studios





Dan Stowell
Software Engineer
Laszlo Studios

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

Reply via email to