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

  • From: julun <host.haiku@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 26 Aug 2008 12:16:36 +0200

Hi Ingo,

Ingo Weinhold schrieb:
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?

hmm, no. Maybe i don't understand your question fully, but i had this:

* RadioButton 1
* RadioButton 2 TextContolView1 TextControlLabel2 TextControlView2
* RadioButton 3

Done like this one had at least to call CreateLabelLayoutItem() for TextContol1, even if not interested in the label. Well one can argue don't use the RadioButton label, which would then not work when used in e.g GridLayout etc. I intended to set the min column width for both TextControlView's, which works fine btw.


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.


I had a certain width for my dialog with some elements like this:

|- BBox -----------------------------------------------------------|
|                                                                  |
|  PopUpMenu                                            BButton    |
|                                                                  |
--------------------------------------------------------------------

I was interested to span the popup menu bar over the whole length close to the button by setting PopUpMenu CreateMenuBarLayoutItem SetExplicitMinSize(BSize(button height, B_SIZE_UNLIMITED )).

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.

Ok, will do then.

Thanks Ingo,
Karsten

Other related posts: