Author: jimtabor Date: Sat Jul 29 01:59:07 2017 New Revision: 75436
URL: http://svn.reactos.org/svn/reactos?rev=75436&view=rev Log: [User32] - Patch by MudHead : Combobox sends a message to the deselect the text when focus is lost. CORE-10266 #resolve
Modified: trunk/reactos/sdk/include/reactos/undocuser.h trunk/reactos/win32ss/user/user32/controls/combo.c trunk/reactos/win32ss/user/user32/controls/edit.c
Modified: trunk/reactos/sdk/include/reactos/undocuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/undocus... ============================================================================== --- trunk/reactos/sdk/include/reactos/undocuser.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/undocuser.h [iso-8859-1] Sat Jul 29 01:59:07 2017 @@ -46,6 +46,7 @@ #define WM_NCUAHDRAWFRAME 0x000000AF #define WM_SYSTIMER 0x00000118 #define WM_LBTRACKPOINT 0x00000131 +#define WM_CBLOSTTEXTFOCUS 0x00000167 #define LB_CARETON 0x000001a3 #define LB_CARETOFF 0x000001a4 #define MN_SETHMENU 0x000001e0
Modified: trunk/reactos/win32ss/user/user32/controls/combo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/control... ============================================================================== --- trunk/reactos/win32ss/user/user32/controls/combo.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/controls/combo.c [iso-8859-1] Sat Jul 29 01:59:07 2017 @@ -2260,6 +2260,19 @@ NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE); } break; + + case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus is lost */ + { + if (lphc->hWndEdit != NULL) + { + SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF); + SendMessage(lphc->hWndEdit, EM_SETSEL, 0, 0); + lphc->wState &= ~CBF_FOCUSED; + CB_NOTIFY(lphc, CBN_KILLFOCUS); + } + } + return TRUE; + #endif
default:
Modified: trunk/reactos/win32ss/user/user32/controls/edit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/control... ============================================================================== --- trunk/reactos/win32ss/user/user32/controls/edit.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/controls/edit.c [iso-8859-1] Sat Jul 29 01:59:07 2017 @@ -3628,6 +3628,28 @@ */ static LRESULT EDIT_WM_KillFocus(EDITSTATE *es) { +#ifdef __REACTOS__ + HWND hCombo; + LONG lStyles; + + es->flags &= ~EF_FOCUSED; + DestroyCaret(); + if(!(es->style & ES_NOHIDESEL)) + EDIT_InvalidateText(es, es->selection_start, es->selection_end); + + /* throw away left over scroll when we lose focus */ + es->wheelDeltaRemainder = 0; + + if (es->hwndListBox == NULL) + EDIT_NOTIFY_PARENT(es, EN_KILLFOCUS); + else + { /* send the undocumented WM_CBLOSTTEXTFOCUS message to combobox */ + hCombo = GetParent(es->hwndSelf); + lStyles = GetWindowLong(hCombo, GWL_STYLE); + if ((lStyles & CBS_DROPDOWN) || (lStyles & CBS_SIMPLE)) + SendMessage(hCombo, WM_CBLOSTTEXTFOCUS, 0, 0); + } +#else es->flags &= ~EF_FOCUSED; DestroyCaret(); if(!(es->style & ES_NOHIDESEL)) @@ -3635,6 +3657,7 @@ EDIT_NOTIFY_PARENT(es, EN_KILLFOCUS); /* throw away left over scroll when we lose focus */ es->wheelDeltaRemainder = 0; +#endif return 0; }