Ok, that makes sense now. It *is* a little strange though in that it isn't symmetrical...
When I query a view for its x or y, it gives me its position relative to the canvas, but when I set a view's x or y, I'm setting the its position relative to its parent. I think it would make more sense if there were two types of x positions.. view.x and view.absolutex view.x is always the x relative to the view's parent. view.absolutex is always the x relative to the canvas. Obviously, this all applies to y as well. -----Original Message----- From: Dan Stowell [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 2:47 PM To: William Krick; [email protected] Subject: RE: [Laszlo-user] syntax problem using variables in a view's x and y > 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
