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()