diff --git a/docs/changes.txt b/docs/changes.txt index 2212610d83..118142fb99 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -127,7 +127,9 @@ wxMSW: - Fix setting icons when they have non-default (16*16 and 32*32) sizes. - Fixed wxLocale::GetInfo to use the C locale. - Don't enable disabled windows when showing them (Harry McKame). -- Fix assert when using owner-drawn menu items with the newest (Vista) SDK +- Fix assert when using owner-drawn menu items with the newest (Vista) SDK. +- Fixed wxTextCtrl to not process clipboard events twice if there's + a custom wxEVT_COMMAND_TEXT_* event handler. wxGTK: diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 6bc5b33551..fc467898b6 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1968,6 +1968,19 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { + // we must handle clipboard events before calling MSWWindowProc, otherwise + // the event would be handled twice if there's a handler for it in user + // code: + switch ( nMsg ) + { + case WM_CUT: + case WM_COPY: + case WM_PASTE: + if ( HandleClipboardEvent(nMsg) ) + return 0; + break; + } + WXLRESULT lRc = wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam); switch ( nMsg ) @@ -2010,13 +2023,6 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara } } break; - - case WM_CUT: - case WM_COPY: - case WM_PASTE: - if ( HandleClipboardEvent(nMsg) ) - lRc = 0; - break; } return lRc;