issue with nested Composites [message #1659503] |
Sun, 08 March 2015 17:31  |
Eclipse User |
|
|
|
Hi all,
I've got a little confused about using nested Composites. This is what
I've written:
private Text txtInput;
private Composite top;
private TableViewer tableViewer;
public void createComposite(Composite parent) {
parent.setLayout(new GridLayout(1, true));
ScrolledComposite scrollcomposite = new ScrolledComposite(parent,
SWT.H_SCROLL | SWT.V_SCROLL);
top = new Composite(scrollcomposite, SWT.NONE );
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(top);
scrollcomposite.setContent(top);
scrollcomposite.setExpandHorizontal(true);
scrollcomposite.setExpandVertical(true);
scrollcomposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true));
txtInput = new Text(top, SWT.BORDER);
txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite nestedComposite = new Composite(scrollcomposite, SWT.BORDER);
Text textField = new Text(nestedComposite, SWT.BORDER);
tableViewer = new TableViewer(top);
tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
}
The point is that all widgets inside nestedComposite don't appear. But I
can't explain why. Is anybody out there who could give me a hint what's
wrong with this code?
TIA,
Ralf.
|
|
|
Re: issue with nested Composites [message #1704058 is a reply to message #1659503] |
Thu, 06 August 2015 22:13  |
Eclipse User |
|
|
|
Hi Ralf,
I think the issue is here:
Composite nestedComposite = new Composite(scrollcomposite, SWT.BORDER);
This is not really a nestedComposite to top.
Composite nestedComposite = new Composite(top, SWT.BORDER);
With this the nested composite should show up.
Also ScrolledComposite does not take a layout so adding multiple composite to it does not work.
|
|
|
Powered by
FUDForum. Page generated in 0.13542 seconds