Project: SWT
Bug 245388 [consistency] Combo.pack() does not consider item lengths
Reported: 2008-08-27 10:54:24 | Status: resolved fixed

- run the snippet below - on platforms != gtk the Combo is pack()ed to a size that is able to fit its longest item -> but on gtk the Combo's preferred size is not influenced by its items public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setBounds(10,10,1000,100); Combo combo = new Combo(shell, SWT.NONE); combo.setLocation(10,10); combo.setItems(new String[] {"asdf","asdfasdfasdf","asdfasdfasdfasdfasdfasdf"}); // combo.add("asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf"); // even longer System.out.println(combo.computeSize(-1, -1)); combo.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java