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

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 10 Apr 2012 14:53:46 -0400

On Tue, Apr 10, 2012 at 2:26 PM, Alex Wilson <yourpalal2@xxxxxxxxx> wrote:
> If you use SetExplicitAlignment(), then everything should work as expected.
> I tested this out myself with a GroupLayout and got the expected results
> (sort of). Here's the code I used: http://pastebin.com/wHD60fhn
>
> You're right that the default left-alignedness of BStringView is not being
> honored though. What it looks like to me is that BStringView has an
> alignment (possibly pre- layout API) that is only used in the
> ResizeToPreferred() method. You can set/get that one with the
> SetAlignment()/Alignment() methods. Maybe the right behaviour is to ignore
> the older alignment, as it does currently, or maybe we should use it in
> calculating the LayoutAlignment() as well.
>
> To me, composing the horizontal dimension of LayoutAlignment() with the
> 'alignment' of the string seems to be the best solution, although it's still
> a bit confusing.

This seems like a much simpler solution than what I proposed. +1

The Alignment() and SetAlignment() methods are pre-Layout API legacy
AFAIK. They are in the BeBook at least. Could we
SetExplicitAlignment(B_ALIGN_LEFT, B_ALIGN_TOP) like you did in the
Layout API constructor for BStringView and have the SetAlignment()
method also SetExplicitAlignment() appropriately if you are using a
StringView built using a Layout API constructor?

It would be nice if I didn't have to call SetExplicitAlignment() for
the default left-aligned case.

John Scipione

Other related posts: