0

I have 3 treeviewer objects in one view in a column like disposition and I want their size to increase equally if I maximize/minimize the view/eclipse window. Here is my code:

Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));

treeViewer1 = new TreeViewer(composite, SWT.BORDER);
tree1 = treeViewer1.getTree();
tree1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
tree1.pack();

treeViewer2 = new TreeViewer(composite, SWT.BORDER);
tree2 = treeViewer2.getTree();
tree2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
tree2.pack();

treeViewer3 = new TreeViewer(composite, SWT.BORDER);
tree3 = treeViewer3.getTree();
tree3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));            
tree3.pack();

However, when the contents of a certain tree are surpass the current viewing space and I maximize/minimize the view, that tree viewing space gets bigger than the others.

Is there a way to prevent this resize behaviour due to content size? Many thanks, ND

Baz
  • 36,440
  • 11
  • 68
  • 94

1 Answers1

0

If you read the documentation of GridLayout, you will find your answer:

Constructs a new instance of this class given the number of columns, and whether or not the columns should be forced to have the same width. If numColumns has a value less than 1, the layout will not set the size and position of any controls.

The solution to your problem is replacing this (since you are talking about columns):

composite.setLayout(new GridLayout(1, false));

with:

composite.setLayout(new GridLayout(3, true));
Baz
  • 36,440
  • 11
  • 68
  • 94