[haiku-development] Re: documentation/help with layout system needed

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 26 Aug 2008 11:51:48 +0200

On 2008-08-26 at 10:53:33 [+0200], julun <host.haiku@xxxxxx> wrote:
> Stephan Assmus schrieb:
> <snip>
> 
> > 
> >     BGridLayout* sizeBoxLayout = new BGridLayout(10, 10);
> >     sizeBox->SetLayout(sizeBoxLayout);
> > 
> >     AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
> >         .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
> >             .Add(nameEdit->CreateLabelLayoutItem())
> >             .Add(nameEdit->CreateTextViewLayoutItem())
> >         )
> >         .Add(BGridLayoutBuilder(sizeBoxLayout)
> >             .Add(widthEdit->CreateLabelLayoutItem(), 0, 0)
> >             .Add(widthEdit->CreateTextViewLayoutItem(), 1, 0)
> >             .Add(widthLabel, 2, 0)
> >             .Add(heightEdit->CreateLabelLayoutItem(), 0, 1)
> >             .Add(heightEdit->CreateTextViewLayoutItem(), 1, 1)
> 
> while using layouts and e.g BTextControl, i noticed that one has to
> always call CreateLabelLayoutItem(), even only interested in the
> textview layout item. Same goes for BPopUpMenu/BMenuField combo.

Wouldn't one simply use the whole object in such a case?

> Do
> they also have to respect the passed explicit min/max size, they don't
> atm.

If you mean the constraints set on the view, that's kind of tricky, since 
the used layout might not even support constraints spanning more than one 
column. By default the label item has fixed width, in which case the view's 
constraints could directly be translated to constraints for the other item, 
but since it is possible to set explicit constraints on the items, that's 
not always feasible.

> Should i file a bug report about this?

It should at least be possible to improve the logic somewhat, so feel free 
to open a ticket.

CU, Ingo

Other related posts: