[haiku-3rdparty-dev] Re: Use of Layout Manager in BBox

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Tue, 19 Mar 2013 09:48:34 +0100 (CET)

Hi Andrew,

On March 19, 2013 at 8:52 AM Andrew Lindesay <apl@xxxxxxxxxxxxxx> wrote:
> ...
> I get everything in the window, but there is a problem that the border
> of the BBox does not show -- possibly covered.  If I scrap the layout
> and just insert a child view then I can see the view and the border.
> Does anybody have or can point me at a use of layout manager with a BBox?

Yes, indeed, while the BBox API is actually logical in a sense, it's not
intuitive at all.
BBox comes with its own layout class that makes sure the one and only contents
view is put so that the border is visible. Therefore, you don't see a custom
layout on the box, but rather simply add a view that does the job for you.

So it would look something like this (not tested):

box->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL)
   .Add(...)
   .View());

Bye,
   Axel.

Other related posts: