Project: SWT
Bug 90223 Regression: Spinner reports wrong value
Reported: 2005-04-04 16:43:21 | Status: resolved fixed

SWT-win32, v3128 (3.1M6) Run the snippet below. Press the down button of the spinner widget. Even though the visible value is now 99, getSelection() reports a value of 100 when called from within the modify listener attached to the spinner. In v3127, the correct value (99) was returned. --- import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class SpinnerTest { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); final Spinner spin = new Spinner(shell, SWT.BORDER); spin.setSelection(100); spin.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { System.out.println("Selection=" + spin.getSelection()); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java