From 4866ac0859bd7dc0d5a8196368789b65a0b98e6e Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov <dmitry@codeweavers.com> Date: Sun, 7 Jan 2001 21:43:49 +0000 Subject: [PATCH] Combobox should clear its current selection on response to CB_SETCURSEL(-1) message. --- controls/combo.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/controls/combo.c b/controls/combo.c index 55a64cc4b6a..11c78e38c47 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -1089,13 +1089,12 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index ) { INT length; LPWSTR pText = NULL; + static const WCHAR empty_stringW[] = { 0 }; TRACE("\t %i\n", index ); if( index >= 0 ) /* got an entry */ { - static const WCHAR empty_stringW[] = { 0 }; - length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, (WPARAM)index, 0); if( length ) { @@ -1105,13 +1104,11 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index ) (WPARAM)index, (LPARAM)pText ); } } - - lphc->wState |= (CBF_NOEDITNOTIFY | CBF_NOLBSELECT); - SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)empty_stringW); - lphc->wState &= ~(CBF_NOEDITNOTIFY | CBF_NOLBSELECT); } - else - InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE); + + lphc->wState |= (CBF_NOEDITNOTIFY | CBF_NOLBSELECT); + SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, pText ? (LPARAM)pText : (LPARAM)empty_stringW); + lphc->wState &= ~(CBF_NOEDITNOTIFY | CBF_NOLBSELECT); if( lphc->wState & CBF_FOCUSED ) SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); -- GitLab