Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333111

Summary: Tall Widgets inside ScrolledComposites become truncated
Product: [Eclipse Project] Platform Reporter: Andrew <andrew.rse+eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: andrew.rse+eclipse, eclipse.felipe, ramirezag, remy.suen
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Andrew CLA 2010-12-22 12:18:57 EST
Build Identifier: 20100917-0705

Creating a very tall (3000 lines) Text or Label and placing it inside a ScrolledComposite with a view to having the whole Text or Label scrollable causes the end of the Text or Label to be truncated

Reproducible: Always

Steps to Reproduce:
1. Compile and run the following code:

			import org.eclipse.swt.SWT;
			import org.eclipse.swt.custom.ScrolledComposite;
			import org.eclipse.swt.layout.FillLayout;
			import org.eclipse.swt.widgets.Composite;
			import org.eclipse.swt.widgets.Display;
			import org.eclipse.swt.widgets.Shell;
			import org.eclipse.swt.widgets.Text;
				
				
				public class ExpandBox2
				{
					public static void main(String[] args)
					{
						Display display = new Display();
						Shell shell = new Shell(display);
						shell.setText("Example");
						shell.setLayout(new FillLayout());
						
						ScrolledComposite scrolledComposite = new ScrolledComposite(shell, SWT.V_SCROLL);
						scrolledComposite.setLayout(new FillLayout(SWT.VERTICAL));
							
						Composite mainComp = new Composite(scrolledComposite, SWT.NONE);
						mainComp.setLayout(new FillLayout(SWT.VERTICAL));
						
						Text styledText = new Text(mainComp, SWT.MULTI);
						styledText.setText(bigString());
						
						mainComp.setSize(mainComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
						scrolledComposite.setContent(mainComp);
						scrolledComposite.setMinSize(mainComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
						scrolledComposite.setExpandHorizontal(true);
						scrolledComposite.setExpandVertical(true);
						scrolledComposite.getVerticalBar().setIncrement(10);
					
						shell.setSize(800, 700);
						shell.open();
						while (!shell.isDisposed ()) {
							if (!display.readAndDispatch ()) {
								display.sleep ();
							}
						}
						display.dispose();
						
					}
					
					private static String bigString()
					{
						String big = "";
						
						for(int i=0;i<3550;i++)
						{
							big = big + i + "hello\r\n";
						}
						System.out.println(big);
						return big;
					}
				
				}

2. Scroll down
3. Note that at a certain point (2519 here. Varies depending on font size etc.) the scrolling hits the end of the Text.
Comment 1 Remy Suen CLA 2010-12-22 12:34:35 EST
Issues with SWT goes to SWT.
Comment 2 Felipe Heidrich CLA 2010-12-23 14:59:35 EST
Your mainComp is too big. There is a limit to size of a windows in win32, your mainComp is bigger than that limit.
Closing as not eclipse (platform limitation). Sorry.
Comment 3 Felipe Heidrich CLA 2010-12-23 14:59:49 EST
closing
Comment 4 Allan Ramirez CLA 2012-01-20 08:33:41 EST
Hi Guys,

I'm facing the same problem. Could you help me on how to create a workaround?