ScrolledComposite does not work properly unless you explicitly set the size of the scrolled content [message #1414843] |
Mon, 01 September 2014 08:18  |
Eclipse User |
|
|
|
Paste the code at the end of this message into the createContents method of a class that extends AbstractEntryPoint (which means that parent in the code below is the top level parent passed into the startup of a RAP application). No vertical scroller appears unless you uncomment the line that explicitly sets the size of the scrolled content. This means that the content is just cut off at the end of the height of the browser window. This is not necessary when running the corresponding code with SWT.
How is this supposed to work? You cannot really know the size needed for the child content. Is there some method that can be run to dynamically determine this size at runtime or is there some other way this is supposed to be handled?
Best regards,
Tomas Normark
GridLayout layout = new GridLayout(1, false);
parent.setLayout(layout);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessVerticalSpace = true;
gridData.verticalAlignment = GridData.FILL;
ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
sc.setLayoutData(gridData);
Composite child = new Composite(sc, SWT.NONE);
GridLayout childLayout = new GridLayout(2, false);
child.setLayout(childLayout);
for (int i=0; i<40; i++) {
Label label = new Label(child, SWT.NONE);
label.setText("Row " + (i+1) + ":");
Text text = new Text(child, SWT.BORDER);
}
// child.setSize(800, 1500);
sc.setContent(child);
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08561 seconds