Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Problem making section content scrollable
Problem making section content scrollable [message #526654] Mon, 12 April 2010 14:08 Go to next message
Oliver Kolling is currently offline Oliver KollingFriend
Messages: 24
Registered: April 2010
Junior Member
Hi, I created a form containing several sections, where some of the section are created with a TableWrapLayout, that have a dynamic size. I would like to keep all sections the same size and make them scrollable as soon as the content exceeds the space I reserved for the sections height. Unfortunatelly I tried already everything like scrolled forms or scrollabelcomposite in any combination. But it looks like that anything that can be scrollable has to have as parent a shell. If I put a scrollabel composite in a form or in a section of a form where section or form is the parent , the scrolling does not work.

I'm missing any point here, or is it simply not possible to have the content of a section scrollable ???

Below my code that creates the sections dynamic content.

Thanks...



TableWrapLayout section_layout = new TableWrapLayout();
section_layout.numColumns = 2;
GridData section_layoutData;
	
section_layoutData = new GridData(GridData.FILL);
section_layoutData.grabExcessHorizontalSpace = true;
section_layoutData.grabExcessVerticalSpace =true;
section_layoutData.minimumWidth = MINSECTION_WITH;
section_layoutData.heightHint = SECTION_HIGHT;
section_layoutData.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER;
section_layoutData.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
	
		
Section section = formToolkit.createSection(dtcForm.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE |Section.EXPANDED);
Composite sectionClient = formToolkit.createComposite(section, SWT.NONE);
section.setClient(sectionClient);
sectionClient.setLayout(section_layout);
section.setLayoutData(section_layoutData);
		
section.setText("Commentaire de l'utilisateur");		
section.setDescription("");

Label label;
TableWrapData td;
		 
for (Cmt cmt : cmtLst)
		{
			td = new TableWrapData();
			td.rowspan = 2;
			td.maxWidth = 60;	
			td.grabHorizontal=true;		
			//label = formToolkit.createLabel(parent, cmt.getDatcre(), SWT.CENTER);
			label = new Label(parent,  SWT.CENTER);
			label.setText(cmt.getDatcre());
			
			label.setFont(UIConstants.CMT_DATE_FONT);
			//label.setBackground(UIConstants.LIGHT_GREY_235);
			label.setLayoutData(td);
			
			td = new TableWrapData();
			td.maxWidth = 200;	
			td.grabHorizontal=true;	
			//label = formToolkit.createLabel(parent, cmt.getUtl(), SWT.NONE );
			label = new Label(parent,  SWT.CENTER);
			label.setText(cmt.getUtl());
			
			label.setFont(UIConstants.CMT_CRE_FONT);
			//label.setBackground(UIConstants.LIGHT_GREY_235);
			label.setLayoutData(td);
					
			td = new TableWrapData();
			td.maxWidth = 200;
			td.grabHorizontal=true;	
			//label = formToolkit.createLabel(parent, cmt.getTxt(), SWT.WRAP );
			label = new Label(parent,  SWT.CENTER);
			label.setText( cmt.getTxt());
			
			label.setFont(UIConstants.CMT_TXT_FONT);
			label.setLayoutData(td);

			
		}
Re: Problem making section content scrollable [message #526843 is a reply to message #526654] Tue, 13 April 2010 09:26 Go to previous message
Oliver Kolling is currently offline Oliver KollingFriend
Messages: 24
Registered: April 2010
Junior Member
Ok, here is the code that maybe makes my problem a bit better to understand or more clear ...?

The code below always shows all of the controls created in the function createSomeButton(). Even if I set the size of the scrolled composite to 10x10 it takes all the needed space to show all buttons instead of showing scrollbars. What do I miss to make the size of the section a fixed size and make the scrolled composite scrolling, if it's content exceeds the size of the section ?

Section section = formToolkit.createSection(dtcForm.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE  |Section.EXPANDED);
		
section.setText("Commentaire de l'utilisateur DTC");
section.setDescription("");
			
		
ScrolledComposite sc1 = new ScrolledComposite(section, SWT.V_SCROLL);
sc1.setExpandVertical(true);
sc1.setExpandHorizontal(true); 
		
Composite c1 = new Composite(sc1, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
		
		
section.setClient(sc1);	  
sc1.setContent(c1);
c1.setLayout(layout);

createSomeButtons(c1);

section.setSize(20, 20);
sc1.setMinSize(section.computeSize(SWT.DEFAULT, SWT.DEFAULT));
sc1.layout();
section.setClient(sc1);
	    
		
section.addExpansionListener(new ExpansionAdapter() {
		public void expansionStateChanged(ExpansionEvent e) {
			dtcForm.reflow(true);
			 }
			 });
		
	


Previous Topic:How to determine the java vendor during runtime
Next Topic:How to refresh the enabledwhen status? A question about "IEvaluationService"?
Goto Forum:
  


Current Time: Fri Apr 26 15:45:37 GMT 2024

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

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

Back to the top