aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2013-10-08 14:19:32 (EDT)
committerBogdan Gheorghe2013-10-08 14:19:32 (EDT)
commit3d7660d12b57efbf49e0dce8bf932fcbbf327686 (patch)
treeba442312a0596deb19e43678c6e6deb1aa06d9e5
parent15a325747f844bbf135d7779e1715b870fd51bba (diff)
downloadeclipse.platform.swt-3d7660d12b57efbf49e0dce8bf932fcbbf327686.zip
eclipse.platform.swt-3d7660d12b57efbf49e0dce8bf932fcbbf327686.tar.gz
eclipse.platform.swt-3d7660d12b57efbf49e0dce8bf932fcbbf327686.tar.bz2
Bug 336054 - Combo eats text on Enter
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java11
1 files changed, 10 insertions, 1 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 47ab420..702463e 100644
--- 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
@@ -2460,7 +2460,16 @@ LRESULT wmChar (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
case SWT.CR:
if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection);
ignoreDefaultSelection = false;
- // FALL THROUGH
+ // when no value is selected in the dropdown
+ if (getSelectionIndex() == -1) {
+ if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) {
+ // close the dropdown if open
+ if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) {
+ OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0);
+ }
+ return LRESULT.ZERO;
+ }
+ }
case SWT.ESC:
if ((style & SWT.DROP_DOWN) != 0) {
if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) {