[haiku-development] Re: Layout problems

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 31 Mar 2009 19:25:28 +0200

Hi,

On 2009-03-31 at 19:20:39 [+0200], Sean Healy <jalopeura@xxxxxxxxxxx> wrote:
> Adding a GroupLayout to an existing container control:
> 
> GroupView *view = new GroupView(rect, group.Name());
> 
> BGroupLayout* viewLayout = new BGroupLayout(B_VERTICAL, 5); 
> viewLayout->SetInsets(5,5,5,5);
> viewLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5)); 
> view->SetLayout(viewLayout);

Before I look at the rest of the code more closely, you are mixing old 
style and layout style when you create a GroupView() with the rect 
parameter. Instead, you should be using a *B*GroupView, which was made for 
exacly that purpose:

BGroupView *view = new BGroupView(B_VERTICAL, 5);
 
BGroupLayout* viewLayout = view->GroupLayout();
viewLayout->SetInsets(5, 5, 5, 5);
viewLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5)); 

... looking closer at the rest of the code you posted now.

Best regards,
-Stephan

Other related posts: