Community
Participate
Working Groups
In this test SelectionEvent.detail always returns 0 and does not match any of these values SWT.ARROW_LEFT , SWT.ARROW_RIGHT , SWT.PAGE_UP , SWT.PAGE_DOWN, SWT.DRAG. Thus it just exits not giving any expected results. Here is the test case: -----------test case starts here ---------------------------------- import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.*; public class TestSWTSliderEvent { static int value; public static void main(String[] args) { Display disp = Display.getDefault(); Shell shell = new Shell(disp); shell.setLayout(new RowLayout(SWT.VERTICAL)); final Slider slide = new Slider(shell, SWT.HORIZONTAL); slide.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int newValue = slide.getSelection(); System.out.println("New value = " + newValue); if (value == newValue) { return; } System.out.println("e.detail is : " + e.detail); switch (e.detail) { case SWT.PAGE_UP : System.out.println( "Page up, selection is: " + newValue); break; case SWT.PAGE_DOWN : System.out.println( "Page down, selection is: " + newValue); break; case SWT.ARROW_UP : System.out.println( "Arrow up, selection is: " + newValue); break; case SWT.ARROW_DOWN : System.out.println( "Arrow down, selection is: " + newValue); break; case SWT.DRAG : System.out.println( "Dragged, selection is: " + newValue); break; default : return; } value = newValue; System.out.println("about to post an adjustment event.."); } }); shell.setSize(150, 150); shell.open(); while (!shell.isDisposed()) { if (!disp.readAndDispatch()) { disp.sleep(); } } } } -----------------------test case ends here ------------------------------
SSQ says there is no API to access this information. VI to enter a bug report against GTK.
I have entered the following bug report against GTK: http://bugzilla.gnome.org/show_bug.cgi?id=93147
*** Bug 26663 has been marked as a duplicate of this bug. ***
Setting OS top all: same problem under Windows XP: stateMask and detail is always 0.
This issue is being tracked in bug 51995. The upstream bug has been fixed in GTK+ 2.6.0 and higher. *** This bug has been marked as a duplicate of 51995 ***