From 52d6b0ae8574c1dc6ee4286a54272b59f4226106 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 6 Sep 2017 12:19:13 +0200 Subject: [PATCH] Don't discard all current input processing flags in response to WM_GETDLGCODE Some current input processing flags, like DLGC_HASSETSEL, should be retained because they are in use (in wxWindowMSW::SetFocusFromKbd() for instance). Closes #17945. --- docs/changes.txt | 1 + src/msw/window.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index eb769ce072..ddf132d01f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -201,6 +201,7 @@ wxMSW: - Fix caching of wxFONTSTYLE_SLANT fonts in wxTheFontList. - Fix wxTextCtrl::XYToPosition() and PositionToXY(). - Fix updating radio groups when non-radio item is inserted to wxMenu. +- Fix autoselecting the contents of wxTextCtrl with wxWANTS_CHARS style. wxOSX: diff --git a/src/msw/window.cpp b/src/msw/window.cpp index c5922d84a1..2005a9a638 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2969,8 +2969,10 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case WM_GETDLGCODE: if ( !IsOfStandardClass() || HasFlag(wxWANTS_CHARS) ) { + // Get current input processing flags to retain flags like DLGC_HASSETSEL, etc. + rc.result = MSWDefWindowProc(WM_GETDLGCODE, 0, 0); // we always want to get the char events - rc.result = DLGC_WANTCHARS; + rc.result |= DLGC_WANTCHARS; if ( HasFlag(wxWANTS_CHARS) ) { @@ -2980,6 +2982,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, DLGC_WANTALLKEYS; } + // Message is marked as processed so MSWDefWindowProc() will not be called once more. processed = true; } //else: get the dlg code from the DefWindowProc()