Could I make a suggestion here? Could someone undertake to make a
page on the website (maybe part of Tutorials) that has a number of
common use cases (such as Greg is citing here) that has worked out
BXML code that implements each use case. Such a page could help reduce
the number of questions/complaints about layout. My apologies if
someone has already done this and I just missed it.
~Roger Whitcomb
Sent from my iPhone
On Mar 18, 2011, at 7:41 AM, Greg Brown <[email protected]> wrote:
In order to wrap, a component needs a width constraint. The "fill"
flag allows us to use the width of the BoxPane as this constraint.
Otherwise, how would we know what the wrap width should be? The
only other way to do it would be to assign an explicit preferred
width to the component.
In layout(), we have a width constraint we could use, which is the
width that has been allocated to us.
How is that different from the current behavior? That's exactly what
"fill" does.
That sounds similar to what Bill described. But, as I mentioned
earlier, Pivot doesn't define horizontal or vertical alignment
properties on the Component class. Layout customization properties
are defined by the container, not the child component. The only
input a child component has into the layout process is preferred
size.
ImageViewSkin and LabelSkin already have "child" properties like
this.
Maybe I misunderstood your suggestion:
Alignment and fill would affect how the bordered component sits
within the space allocated by the parent container.
What is "the parent container" in this case? If it is the Border
itself, then yes, those properties would be consistent with
ImageView, Label, Border, etc. But that brings me back to my
previous point - I don't think the use case for customizing
alignment within a Border is particularly strong. There are two
primary use cases for a Border:
1) You want the content to fill the border's bounds, and you want
the border to grow/shrink with the content's preferred size.
2) You want the border to have some fixed size, and you want the
content to be scrollable if it exceeds the size of the border.
In case #1, an alignment style would be useless since it would
always be ignored. In case #2, you'll need to put a scroll pane in
the border and make the actual content a child of the scroll pane,
so the alignment styles would be ignored here too.