[haiku-development] Can we make BStringView's MaxSize = BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET) by default?

Working with UI code recently I've been caught by this small annoyance
a couple times now.

BStringView's by default are set to by only as wide as the text. So if
you don't make sure to SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
B_SIZE_UNSET)); on the string view then your string views won't get
aligned based on the Alignment() property, e.g. B_ALIGN_LEFT,

So if you have some code that you want to look like this:

stringView1         control1
stringView2         control2
stringView3         control3

and you write the layout code without SetExplictiMaxSize() you'll
actually get something like this:

   stringView1      control1
 stringView2        control2
     stringView3    control3

The Alignment() property of the BStringView's will be effectively ignored.

So to get a series of left-aligned string views I have to create the
BStringView's first, SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
B_SIZE_UNSET)) on each of them, and then use the BStringView in the
<Group><Grid><etc>Layout. Since BStringView's are supposed to be
left-aligned by default this makes the code harder and seems like a
"gotcha" to me. It would be a lot easier if I could simply create
StringView's inline when building the layout for the default case of
left-aligned string views.

For the case of B_ALIGN_CENTER and B_ALIGN_RIGHT string views you'll
have similar  problems if you don't SetExplicitMaxSize() on them.
Although this doesn't have the same code size savings since you'll
have to make sure to SetAlignment() on them before you can use them

Thanks for your consideration,

John Scipione

Other related posts: