Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 21464 - GTK: SelectionEvent.detail does not return expected values(BBAWT)
Summary: GTK: SelectionEvent.detail does not return expected values(BBAWT)
Status: RESOLVED DUPLICATE of bug 51995
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 26663 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-10 15:18 EDT by chirag gandhi CLA
Modified: 2005-05-29 14:33 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chirag gandhi CLA 2002-07-10 15:18:02 EDT
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 ------------------------------
Comment 1 Veronika Irvine CLA 2002-09-11 17:31:03 EDT
SSQ says there is no API to access this information.  VI to enter a bug report 
against GTK.
Comment 2 Veronika Irvine CLA 2002-09-12 12:46:02 EDT
I have entered the following bug report against GTK:

http://bugzilla.gnome.org/show_bug.cgi?id=93147
Comment 3 Christophe Cornu CLA 2003-05-02 17:44:57 EDT
*** Bug 26663 has been marked as a duplicate of this bug. ***
Comment 4 Dani Megert CLA 2003-09-24 09:02:31 EDT
Setting OS top all: same problem under Windows XP: stateMask and detail is always 0.
Comment 5 Billy Biggs CLA 2005-05-29 14:33:43 EDT
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 ***