Bug 5056 - Combo.select() fires selection event on Linux, but not on Windows
Summary: Combo.select() fires selection event on Linux, but not on Windows
Status: RESOLVED DUPLICATE of bug 4910
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-17 16:32 EDT by David Whiteman CLA
Modified: 2001-10-18 09:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Whiteman CLA 2001-10-17 16:32:10 EDT
When you call the select() method on the Combo widget on Windows, no selection 
event is fired.  However, on Linux, a selection event is fired.  It doesn't 
matter if select() is called before or after the widget is visible.

In the following testcase, the call to select() does not cause the message to 
be printed to the console on Windows.  It does, however, on Linux.  Even moving 
the select() call before the shell.open() causes the same results.
Comment 1 David Whiteman CLA 2001-10-17 16:33:33 EDT
example code
============

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;

//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
public class PR_5056 {
	private Display  display;
	private Shell    shell;
	private Combo   c;

//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
static public void main(String[] args) {
	new PR_5056().runMain(args);
}

//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
private void runMain(String[] args) {

	display = new Display();
	
	shell = new Shell(display);
	shell.setText(getClass().getName());
	shell.setBounds(0,0,200,200);
	shell.setLayout(new GridLayout());
	
	c = new Combo(shell,SWT.DROP_DOWN | SWT.READ_ONLY);
	c.add("Item 1");
	c.add("Item 2");
	c.add("Item 3");
	c.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
		public void widgetSelected
(org.eclipse.swt.events.SelectionEvent e) {
			// on Windows, this is not invoked by the Combo.select
() call
			System.out.println(c.getSelectionIndex()); 
		}
	});
		
	shell.open();
	c.select(0);


	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}

====
Let me add that I prefer the Windows behavior over the Linux behavior :-)
}
Comment 2 Mike Wilson CLA 2001-10-18 08:57:40 EDT
The behavior should be made consistant between platforms if possible.
Comment 3 Grant Gayed CLA 2001-10-18 09:24:52 EDT
Actually the fix for this was already made last week and will be in this 
morning's build.  Both platforms now behave like Windows.


*** This bug has been marked as a duplicate of 4910 ***