I think you'd need a custom layout for this. Something that loops through all
the subviews, finds the one with the largest width and sets the parent width
based on that.
I hacked this together very quickly as an example - it's untested, but might
work for you as a starting point:
<canvas height="100">
<view name = "container"/> <!-- this is the view that holds your subviews -->
<layout>
<attribute name="spacing" value="25" type="number"/>
<method name="addSubview" args="s">
super.addSubview(s);
this.update();
</method>
<method name="update">
<![CDATA[
if (this.locked) return;
this.locked = true;
var largestWidth = 0;
//loop through all the subviews and
//find the one with the largest width
for (var i = 0; i < subviews.length; i++){
if (subviews[i].width > largestWidth) {
largestWidth = subviews[i].width;
}
}
//now set the parent width to
//largestWidth (plus a bit for luck)
parent.width = largestWidth + 20;
this.locked = false;
]]>
</method>
</layout>
<!-- your other views go here //-->
<view/>
<view/>
<view/>
<view/>
</view>
</canvas>
Hope that helps.
Nick
On Friday, April 07, 2006, at 02:15PM, Robin <[EMAIL PROTECTED]> wrote:
>I have a view that contains a number of other views, expanding out sideways
>based on data replication. What I'd like to do is make the width of the parent
>change itself to be the width that will enclose all those subviews, such that
>constraints that lay other components out based on the width of this one end
>up correct.
>
>How can I do this?
>
>Cheers, Robin.
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user