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: 235
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,
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] 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: Fri Apr 26 00:10:30 GMT 2024

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

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

Back to the top