[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: TabItem and Table

// -- When i do this, my Table appears without scrollbars --
//  cfolder.setLayout(new GridLayout(1,false));

// -- And when i do that, my Table appears with scrollbars --
cfolder.setLayout(new FillLayout());
// -- Do you know where's my mistake??? --


By default, GridLayout will make the children as big as their preferred
size.  For a Table, the preferred size is big enough so that no scrollbars
are required.  The preferred size for a TabFolder is to be big enough to
show its largest child.  To make the TabFolder have something different from
its preferred size, you must specify some GridData for the table that will
specify how to constrain the size of the table such as:

    cfolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    tFolder.setLayoutData(new GridData(GridData.FILL_BOTH));

But, if you only ever have one child in the composite and you are setting
GridData.FILL_BOTH then you might as well use a FillLayout.