Better CB_SETCURSEL message handling.
diff --git a/controls/combo.c b/controls/combo.c index 8276351..915ee47 100644 --- a/controls/combo.c +++ b/controls/combo.c
@@ -8,7 +8,8 @@ #include <string.h> -#include "windows.h" +#include "winuser.h" +#include "wine/winuser16.h" #include "sysmetrics.h" #include "win.h" #include "spy.h" @@ -1545,7 +1546,15 @@ case CB_SETCURSEL16: wParam = (INT32)(INT16)wParam; case CB_SETCURSEL32: - return SendMessage32A( lphc->hWndLBox, LB_SETCURSEL32, wParam, 0); + lParam = SendMessage32A( lphc->hWndLBox, LB_SETCURSEL32, wParam, 0); + if( lphc->wState & CBF_SELCHANGE ) + { + /* no LBN_SELCHANGE in this case, update manually */ + + CBPaintText( lphc, 0 ); + lphc->wState &= ~CBF_SELCHANGE; + } + return lParam; case CB_GETLBTEXT16: wParam = (INT32)(INT16)wParam;
diff --git a/controls/listbox.c b/controls/listbox.c index 02450cb..3405121 100644 --- a/controls/listbox.c +++ b/controls/listbox.c
@@ -5,7 +5,8 @@ */ #include <string.h> -#include "windows.h" +#include "wine/winuser16.h" +#include "winuser.h" #include "winerror.h" #include "drive.h" #include "heap.h" @@ -1231,6 +1232,9 @@ if (index != -1) LISTBOX_RepaintItem( wnd, descr, index, ODA_SELECT ); if (send_notify) SEND_NOTIFICATION( wnd, descr, (index != -1) ? LBN_SELCHANGE : LBN_SELCANCEL ); + else + if( descr->lphc ) /* set selection change flag for parent combo */ + descr->lphc->wState |= CBF_SELCHANGE; } return LB_OKAY; } @@ -2281,7 +2285,7 @@ /* fall through */ case LB_SETCURSEL32: if (wParam != -1) LISTBOX_MakeItemVisible( wnd, descr, wParam, TRUE ); - return LISTBOX_SetSelection( wnd, descr, wParam, TRUE, (descr->lphc != NULL) ); + return LISTBOX_SetSelection( wnd, descr, wParam, TRUE, FALSE ); case LB_GETSELCOUNT16: case LB_GETSELCOUNT32: @@ -2584,6 +2588,11 @@ } return LISTBOX_HandleKeyDown( wnd, descr, wParam ); + case LB_SETCURSEL16: + case LB_SETCURSEL32: + lRet = ListBoxWndProc( hwnd, msg, wParam, lParam ); + return (lRet == LB_ERR) ? lRet : descr->selected_item; + case WM_NCDESTROY: if( CB_GETTYPE(lphc) != CBS_SIMPLE ) lphc->hWndLBox = 0;
diff --git a/include/combo.h b/include/combo.h index 3b2e8e2..3cf3b6b 100644 --- a/include/combo.h +++ b/include/combo.h
@@ -20,6 +20,7 @@ #define CBF_NORESIZE 0x0080 #define CBF_NOTIFY 0x0100 #define CBF_NOREDRAW 0x0200 +#define CBF_SELCHANGE 0x0400 #define CBF_EUI 0x8000 /* Combo state struct */