[haiku-development] BBox and layout

  • From: Clemens <clemens.zeidler@xxxxxxxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Mon, 07 May 2012 08:37:42 +1200

Hi,

just had these two problems with a BBox:

1) I added a menu field as a label for a BBox and a layout to the BBox. In this case in DoLayout *) the label view is removed, BView::DoLayout called and the label is added again. The comment says this is because the label should not be layouted. The problem is that AddChild triggers a relayout which results in an infinite loop.

My first solution is to just leave the label added to the BBox while calling BView::DoLayout and just move it back to the right position afterwards. This works fine but why BView::DoLayout layouts the label view at all? I mean the label is not part of any layout class so it should be ignored or what is the policy here?

2) When setting a layout to a BBox its a bit annoying to set the correct layout inset so that the content is exactly within the inner BBox frame. It would be nice to have some convenient function to set the inset to the layout. Or even better: the layout of a BBox is moved automatically into the inner frame so that it is not event possible to place a layout item outside the inner frame. What do you think?

Cheers,
        Clemens

*)
http://haiku.it.su.se:8180/source/xref/src/kits/interface/Box.cpp#DoLayout

Other related posts: