Project: SWT
Bug 19153 Combo fires too many SelectionEvents in GTK2
Reported: 2002-06-04 14:07:18 | Status: resolved fixed

Build F2 (20020602) Redhat 7.2, GTK2 KDE 2.2-10 (GTK2 only) If you add a SelectionListener to a Combo, then your widgetSelected() will be called many more times than would be expected. For example, If you click and hold the arrow then move on one of the elements in the drop down list (still holding button), then it continually fires events even though you're not moving. Also, every element you move your mouse over causes multiple selection events. Another problem is that as soon as you click the arrow then move your mouse one pixel, the first element is selected. This can be bad if you don't remember what it was on before and just want to see the options. This example demonstrates this.. it just prints "X" everytime widgetSelected() is called. ----------------------------------------------- public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); shell.setSize(200, 200); Combo combo = new Combo(shell, SWT.DEFAULT); combo.add("a"); combo.add("bbb"); combo.add("cccccc"); combo.select(0); combo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { System.out.print("X"); } }); 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