Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » issue with nested Composites
issue with nested Composites [message #1659503] Sun, 08 March 2015 21:31 Go to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 225
Registered: July 2009
Senior Member
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,
top = new Composite(scrollcomposite, SWT.NONE );

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?

Re: issue with nested Composites [message #1704058 is a reply to message #1659503] Fri, 07 August 2015 02:13 Go to previous message
Abhishek Singh is currently offline Abhishek SinghFriend
Messages: 4
Registered: August 2015
Junior Member
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.
Previous Topic:StyledText - problems with Background
Next Topic:Scrolled composite of composite is not scrolling in linux GTK3
Goto Forum:

Current Time: Thu Feb 25 08:05:41 GMT 2021

Powered by FUDForum. Page generated in 0.01543 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top