Bug 4942 - Combo selection index should move when upper item removed (1GLGA41)
Summary: Combo selection index should move when upper item removed (1GLGA41)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC QNX-Photon
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-12 14:30 EDT by David Whiteman CLA
Modified: 2002-05-15 14:38 EDT (History)
0 users

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-12 14:30:46 EDT
PRODUCT VERSION:
	SWT 2.003 Photon

DESCRIPTION:

	DLW (10/11/2001 5:05:03 PM):
		When an item is removed from a Combo widget, and an item 
		is already selected farther down in the list, the selection
		index should be adjusted to correspond with the item that
		moved up in the list.

		In the following example, the selectionIndex should be 1 
		after item 0 is removed, since the previously selected 
		item moved up from location 2 to location 1 in the list.

--- cut here ----------

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

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

//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
static public void main(String[] args) {
	new PR_1GLGA41().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");
		
	shell.open();

	c.select(2);
	c.remove(0);
	System.out.println(c.getSelectionIndex()); // should be 1

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


}

---- cut here ----------

NOTES:

=======================================
Comment 1 DJ Houghton CLA 2001-10-29 16:45:10 EST
PRODUCT VERSION:
	SWT 2.003 Photon

Comment 2 David Whiteman CLA 2002-01-08 12:52:35 EST
What's the status on this?
Comment 3 Silenio Quarti CLA 2002-05-15 14:24:09 EDT
Not sure why this was not fixed yet. Anyway, fixed >20020514.
Comment 4 David Whiteman CLA 2002-05-15 14:38:16 EDT
Thanks Silenio!