summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2006-09-25 18:28:30 +0000
committerSteve Northover <steve>2006-09-25 18:28:30 +0000
commit22e2cb42dd6bedfa7c3ae2b39a3d0b4bdbc30df8 (patch)
tree1207c506be2ceedd6fbd2d54fa3d942232b48809
parent819094da718c6570c737d38a3e41a8a9970cd886 (diff)
downloadeclipse.platform.swt-22e2cb42dd6bedfa7c3ae2b39a3d0b4bdbc30df8.tar.gz
eclipse.platform.swt-22e2cb42dd6bedfa7c3ae2b39a3d0b4bdbc30df8.tar.xz
eclipse.platform.swt-22e2cb42dd6bedfa7c3ae2b39a3d0b4bdbc30df8.zip
158577 - combo.setItem dispatchs a ModifyListener event with empty text
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
index d2ac5392b7..699dc61a52 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
@@ -991,6 +991,10 @@ void register () {
*/
public void remove (int index) {
checkWidget ();
+ remove (index, true);
+}
+
+void remove (int index, boolean notify) {
TCHAR buffer = null;
if ((style & SWT.H_SCROLL) != 0) {
int length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
@@ -1015,7 +1019,7 @@ public void remove (int index) {
error (SWT.ERROR_INVALID_RANGE);
}
if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, true);
- if (length != OS.GetWindowTextLength (handle)) {
+ if (notify && length != OS.GetWindowTextLength (handle)) {
sendEvent (SWT.Modify);
if (isDisposed ()) return;
}
@@ -1409,9 +1413,7 @@ void setForegroundPixel (int pixel) {
/**
* Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to removing the old item at the index, and then adding the new
- * item at that index.
+ * zero-relative index to the string argument.
*
* @param index the index for the item
* @param string the new text for the item
@@ -1428,13 +1430,11 @@ void setForegroundPixel (int pixel) {
public void setItem (int index, String string) {
checkWidget ();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int selection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
- remove (index);
+ int selection = getSelectionIndex ();
+ remove (index, false);
if (isDisposed ()) return;
add (string, index);
- if (selection != -1) {
- OS.SendMessage (handle, OS.CB_SETCURSEL, selection, 0);
- }
+ if (selection != -1) select (selection);
}
/**