| 
| Wrong position of combo's dropdown on ScrolledForm [message #115799] | Mon, 15 December 2008 12:12  |  | 
| Eclipse User  |  |  |  |  | Hi all, 
 Here's another snippet to reproduce the problem:
 
 public class ComboDemoEntryPoint implements IEntryPoint
 {
 @Override
 public int createUI()
 {
 Display display = new Display();
 Shell shell = new Shell(display,SWT.SHELL_TRIM);
 shell.setLayout(GridLayoutFactory.swtDefaults().create());
 
 FormToolkit toolkit = new FormToolkit(display);
 
 ScrolledForm container = toolkit.createScrolledForm(shell);
 container.setLayoutData(GridDataFactory.fillDefaults().grab( true,
 true).create());
 
 container.getBody().setLayout(GridLayoutFactory.fillDefaults ().create());
 
 ComboViewer comboViewer = new
 ComboViewer(container.getBody(),SWT.READ_ONLY);
 
 comboViewer.getCombo().setLayoutData(GridDataFactory.fillDef aults().grab(true,
 false).create());
 comboViewer.add(new String[]{"Item 1","Item 2"});
 
 comboViewer = new ComboViewer(container.getBody(),SWT.READ_ONLY);
 
 comboViewer.getCombo().setLayoutData(GridDataFactory.fillDef aults().grab(true,
 false).create());
 comboViewer.add(new String[]{"Item 3","Item 4"});
 
 comboViewer = new ComboViewer(container.getBody(),SWT.READ_ONLY);
 
 comboViewer.getCombo().setLayoutData(GridDataFactory.fillDef aults().grab(true,
 false).create());
 comboViewer.add(new String[]{"Item 5","Item 6"});
 
 comboViewer = new ComboViewer(container.getBody(),SWT.READ_ONLY);
 
 comboViewer.getCombo().setLayoutData(GridDataFactory.fillDef aults().grab(true,
 false).create());
 comboViewer.add(new String[]{"Item 7","Item 8"});
 
 comboViewer = new ComboViewer(container.getBody(),SWT.READ_ONLY);
 
 comboViewer.getCombo().setLayoutData(GridDataFactory.fillDef aults().grab(true,
 false).create());
 comboViewer.add(new String[]{"Item 9","Item 10"});
 
 shell.setSize(150,150);
 shell.open();
 
 while (!shell.isDisposed())
 {
 if (!display.readAndDispatch())
 display.sleep();
 }
 
 return 0;
 }
 }
 
 Upon running, scroll to the last combo then click to show its dropdown,
 you can see the position is not right.
 
 Regards,
 
 Setya
 |  |  |  | 
|  | 
|  | 
|  | 
| 
| Re: Wrong position of combo's dropdown on ScrolledForm [message #116007 is a reply to message #115917] | Wed, 17 December 2008 04:35   |  | 
| Eclipse User  |  |  |  |  | Hi Setya, 
 even your latest snippet looks fine here.
 
 Ralf
 
 Setya wrote:
 > Hi,
 >
 > I can confirm that the problem no longer exists using latest source from
 > CVS and from my previous snippet.
 >
 > But I still can reproduce it with the following snippet & latest source
 > from CVS:
 >
 > @Override
 > public int createUI()
 > {
 > Display display = new Display();
 > Shell shell = new Shell(display,SWT.SHELL_TRIM);
 > shell.setLayout(GridLayoutFactory.swtDefaults().create());
 >
 > FormToolkit toolkit = new FormToolkit(display);
 >
 > ScrolledForm container = toolkit.createScrolledForm(shell);
 >
 >  container.setLayoutData(GridDataFactory.fillDefaults().grab( true,
 > true).create());
 >
 >  container.getBody().setLayout(GridLayoutFactory.fillDefaults ().create());
 >
 > for (int i = 0; i <= 25; i++)
 > {
 > ComboViewer comboViewer = new
 > ComboViewer(container.getBody(),SWT.READ_ONLY);
 >
 >  comboViewer.getCombo().setLayoutData(GridDataFactory.fillDef aults().grab(true,
 > false).create());
 > comboViewer.add(new String[]{"Item 1","Item 2"});
 > }
 >
 > shell.setMaximized(true);
 > shell.open();
 >
 > while (!shell.isDisposed())
 > {
 > if (!display.readAndDispatch())
 > display.sleep();
 > }
 >
 > return 0;
 > }
 >
 > This time don't bother scrolling, just go to the last combo and click to
 > dropdown.
 >
 > Regards,
 >
 > Setya
 >
 |  |  |  | 
|  | 
|  | 
|  | 
|  | 
Powered by 
FUDForum. Page generated in 0.04805 seconds