Better CB_SETCURSEL message handling.

This commit is contained in:
Alex Korobka 1999-01-01 18:40:02 +00:00 committed by Alexandre Julliard
parent dbf2bf00bc
commit 311d329cb8
3 changed files with 23 additions and 4 deletions

View File

@ -8,7 +8,8 @@
#include <string.h> #include <string.h>
#include "windows.h" #include "winuser.h"
#include "wine/winuser16.h"
#include "sysmetrics.h" #include "sysmetrics.h"
#include "win.h" #include "win.h"
#include "spy.h" #include "spy.h"
@ -1545,7 +1546,15 @@ LRESULT WINAPI ComboWndProc( HWND32 hwnd, UINT32 message,
case CB_SETCURSEL16: case CB_SETCURSEL16:
wParam = (INT32)(INT16)wParam; wParam = (INT32)(INT16)wParam;
case CB_SETCURSEL32: 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: case CB_GETLBTEXT16:
wParam = (INT32)(INT16)wParam; wParam = (INT32)(INT16)wParam;

View File

@ -5,7 +5,8 @@
*/ */
#include <string.h> #include <string.h>
#include "windows.h" #include "wine/winuser16.h"
#include "winuser.h"
#include "winerror.h" #include "winerror.h"
#include "drive.h" #include "drive.h"
#include "heap.h" #include "heap.h"
@ -1231,6 +1232,9 @@ static LRESULT LISTBOX_SetSelection( WND *wnd, LB_DESCR *descr, INT32 index,
if (index != -1) LISTBOX_RepaintItem( wnd, descr, index, ODA_SELECT ); if (index != -1) LISTBOX_RepaintItem( wnd, descr, index, ODA_SELECT );
if (send_notify) SEND_NOTIFICATION( wnd, descr, if (send_notify) SEND_NOTIFICATION( wnd, descr,
(index != -1) ? LBN_SELCHANGE : LBN_SELCANCEL ); (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; return LB_OKAY;
} }
@ -2281,7 +2285,7 @@ LRESULT WINAPI ListBoxWndProc( HWND32 hwnd, UINT32 msg,
/* fall through */ /* fall through */
case LB_SETCURSEL32: case LB_SETCURSEL32:
if (wParam != -1) LISTBOX_MakeItemVisible( wnd, descr, wParam, TRUE ); 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_GETSELCOUNT16:
case LB_GETSELCOUNT32: case LB_GETSELCOUNT32:
@ -2584,6 +2588,11 @@ LRESULT WINAPI ComboLBWndProc( HWND32 hwnd, UINT32 msg,
} }
return LISTBOX_HandleKeyDown( wnd, descr, wParam ); 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: case WM_NCDESTROY:
if( CB_GETTYPE(lphc) != CBS_SIMPLE ) if( CB_GETTYPE(lphc) != CBS_SIMPLE )
lphc->hWndLBox = 0; lphc->hWndLBox = 0;

View File

@ -20,6 +20,7 @@
#define CBF_NORESIZE 0x0080 #define CBF_NORESIZE 0x0080
#define CBF_NOTIFY 0x0100 #define CBF_NOTIFY 0x0100
#define CBF_NOREDRAW 0x0200 #define CBF_NOREDRAW 0x0200
#define CBF_SELCHANGE 0x0400
#define CBF_EUI 0x8000 #define CBF_EUI 0x8000
/* Combo state struct */ /* Combo state struct */