Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Include a Sash in a ScrolledComposite?(Howto include a Sash in a ScrolledComposite?)
icon5.gif  Include a Sash in a ScrolledComposite? [message #695713] Tue, 12 July 2011 11:45 Go to next message
Renaud C is currently offline Renaud CFriend
Messages: 19
Registered: May 2011
Junior Member
Hello,
Here is my problem, I would like to divide my window in two parts (top / bottom) splited by a sash (horizontal) : That's OK :

public void createPartControl(Composite parent) {
	    parent.setLayout(new FormLayout());
		
		Sash horizontalSash = new Sash(parent, SWT.BORDER | SWT.HORIZONTAL);
	    FormData data = new FormData();
	    data.top = new FormAttachment(50, 0); 
	    data.bottom = new FormAttachment(53, 0); 
	    data.right = new FormAttachment(100, 0);
	    data.left = new FormAttachment(0, 0);
	    horizontalSash.setLayoutData(data);


But now, I would like a scrolledcomposite in each part, and split the top-part with another sash (vertical). I wrote this below, but it doesn't work and I really don't know why...

	    ScrolledComposite top = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	    FormData data4 = new FormData();
	    data4.top = new FormAttachment(0, 0);
	    data4.bottom = new FormAttachment(horizontalSash, 0);
	    data4.left = new FormAttachment(0, 0);
	    data4.right = new FormAttachment(100, 0);
	    top.setLayout(new FormLayout());
	    top.setLayoutData(data4);
	    
		Sash verticalSash = new Sash(top, SWT.BORDER | SWT.VERTICAL);
	    FormData data2 = new FormData();
	    data2.top = new FormAttachment(0, 0); 
	    data2.bottom = new FormAttachment(100, 0); 
	    data2.right = new FormAttachment(53, 0);
	    data2.left = new FormAttachment(50, 0);
	    verticalSash.setLayoutData(data2);
	    
	    ScrolledComposite bottom = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	    FormData data3 = new FormData();
	    data3.top = new FormAttachment(horizontalSash, 0);
	    data3.bottom = new FormAttachment(100, 0);
	    data3.left = new FormAttachment(0, 0);
	    data3.right = new FormAttachment(100, 0);
	    bottom.setLayout(new FormLayout());
	    bottom.setLayoutData(data3);


Thanks for your advice and help!
Re: Include a Sash in a ScrolledComposite? [message #696123 is a reply to message #695713] Wed, 13 July 2011 10:02 Go to previous message
Renaud C is currently offline Renaud CFriend
Messages: 19
Registered: May 2011
Junior Member
Finally, I used a SashForm that do everything I wanted to display 3 treeviewer.

public void createPartControl(Composite parent) {
	    parent.setLayout(new FillLayout());
	    
	    SashForm sash2 = new SashForm(parent, SWT.BORDER | SWT.VERTICAL);
	    
		SashForm sash = new SashForm(sash2, SWT.BORDER | SWT.HORIZONTAL);
		    
		    group1 = new Group(sash, SWT.SHADOW_IN);
		    group1.setText(filename1);
		    group1.setLayout(new FillLayout());
			treeviewer = new CheckboxTreeViewer(group1, SWT.H_SCROLL | SWT.V_SCROLL);
			treeviewer.setContentProvider(new TreeContentProvider());
			treeviewer.setLabelProvider(new TreeLabelProvider());
			
		    group2 = new Group(sash, SWT.SHADOW_IN);
		    group2.setText(filename2);
		    group2.setLayout(new FillLayout());
			treeviewerTwo = new CheckboxTreeViewer(group2, SWT.H_SCROLL | SWT.V_SCROLL);
			treeviewerTwo.setContentProvider(new TreeContentProviderTwo());
			treeviewerTwo.setLabelProvider(new TreeLabelProvider());
		
		Group group3 = new Group(sash2, SWT.SHADOW_IN);
	        group3.setText("Result");
	        group3.setLayout(new FillLayout());
		treeviewerResult = new TreeViewer(group3, SWT.H_SCROLL | SWT.V_SCROLL);
		treeviewerResult.setContentProvider(new TreeContentProviderResult());
		treeviewerResult.setLabelProvider(new TreeLabelProviderResult());
}
Previous Topic:Tabitems / Tabfolder with SWT 3.6.2 on Win7 64 bit
Next Topic:DateTime Widget Date Format
Goto Forum:
  


Current Time: Mon Dec 22 02:04:11 GMT 2014

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

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