Jay Yang : comctl32: Make ComboBoxEx send CBEN_ENDEDIT when selecting from the dropdown list.

Alexandre Julliard julliard at winehq.org
Fri Jun 24 13:54:02 CDT 2011


Module: wine
Branch: master
Commit: 30fa4cb5d0488e8464a5b4e0f22da1908cf4e235
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=30fa4cb5d0488e8464a5b4e0f22da1908cf4e235

Author: Jay Yang <jkelleyy at gmail.com>
Date:   Thu Jun 23 14:56:14 2011 -0400

comctl32: Make ComboBoxEx send CBEN_ENDEDIT when selecting from the dropdown list.

---

 dlls/comctl32/comboex.c       |    8 ++++----
 dlls/comctl32/tests/comboex.c |   30 +++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index 319696d..3402a71 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -1120,10 +1120,10 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam)
     switch (command)
     {
     case CBN_DROPDOWN:
-	SetFocus (infoPtr->hwndCombo);
-	ShowWindow (infoPtr->hwndEdit, SW_HIDE);
-	return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
-
+        SetFocus (infoPtr->hwndCombo);
+        ShowWindow (infoPtr->hwndEdit, SW_HIDE);
+        infoPtr->flags |= WCBE_ACTEDIT;
+        return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
     case CBN_CLOSEUP:
 	SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
 	/*
diff --git a/dlls/comctl32/tests/comboex.c b/dlls/comctl32/tests/comboex.c
index 59c261c..172e564 100644
--- a/dlls/comctl32/tests/comboex.c
+++ b/dlls/comctl32/tests/comboex.c
@@ -42,6 +42,8 @@ static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR
 #define MAX_CHARS 100
 static char *textBuffer = NULL;
 
+static BOOL received_end_edit = FALSE;
+
 static HWND createComboEx(DWORD style) {
    return CreateWindowExA(0, WC_COMBOBOXEXA, NULL, style, 0, 0, 300, 300,
             hComboExParentWnd, NULL, hMainHinst, NULL);
@@ -341,6 +343,7 @@ static void test_WM_LBUTTONDOWN(void)
     ok(idx == 4 ||
        broken(idx == -1), /* win98 */
        "Current Selection: expected %d, got %d\n", 4, idx);
+    ok(received_end_edit, "Expected to receive a CBEN_ENDEDIT message\n");
 
     DestroyWindow(hComboEx);
 }
@@ -427,6 +430,30 @@ static void test_WM_WINDOWPOSCHANGING(void)
     ok(ret, "DestroyWindow failed\n");
 }
 
+static LRESULT ComboExTestOnNotify(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    NMHDR *hdr = (NMHDR*)lParam;
+    switch(hdr->code){
+    case CBEN_ENDEDITA:
+        {
+            NMCBEENDEDITA *edit_info = (NMCBEENDEDITA*)hdr;
+            if(edit_info->iWhy==CBENF_DROPDOWN){
+                received_end_edit = TRUE;
+            }
+            break;
+        }
+    case CBEN_ENDEDITW:
+        {
+            NMCBEENDEDITW *edit_info = (NMCBEENDEDITW*)hdr;
+            if(edit_info->iWhy==CBENF_DROPDOWN){
+                received_end_edit = TRUE;
+            }
+            break;
+        }
+    }
+    return 0;
+}
+
 static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     switch(msg) {
@@ -434,7 +461,8 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
     case WM_DESTROY:
         PostQuitMessage(0);
         break;
-  
+    case WM_NOTIFY:
+        return ComboExTestOnNotify(hWnd,msg,wParam,lParam);
     default:
         return DefWindowProcA(hWnd, msg, wParam, lParam);
     }




More information about the wine-cvs mailing list