From: Vadim Zeitlin Date: Tue, 5 Apr 2005 22:59:22 +0000 (+0000) Subject: don't let WM_RBUTTONDOWN reach def window proc as it would enter a local modal messag... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fbd8ac5236fa20355e69418f79b0c2aef8aa050e don't let WM_RBUTTONDOWN reach def window proc as it would enter a local modal message loop waiting for WM_RBUTTONUO and hose our event generation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 21f4d1b744..c315096dfd 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -425,6 +425,7 @@ public: virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWCommand(WXUINT param, WXWORD id); virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 8cc634935e..c09e85d205 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2275,13 +2275,6 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara // newly selected item ::SelectItem(GetHwnd(), htItem); ::SetFocus(GetHwnd(), htItem); - - // default WM_RBUTTONUP handler enters modal loop inside - // DefWindowProc() waiting for WM_RBUTTONDOWN and then sends - // the resulting WM_CONTEXTMENU to the parent window, not us, - // which completely breaks everything so simply don't let it - // see this message at all - processed = true; break; #if !wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE @@ -2541,6 +2534,19 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara return rc; } +WXLRESULT +wxTreeCtrl::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + // default WM_RBUTTONDOWN handler enters modal loop inside DefWindowProc() + // waiting for WM_RBUTTONUP and then sends the resulting WM_CONTEXTMENU to + // the parent window, not us, which completely breaks everything so simply + // don't let it see this message at all + if ( nMsg == WM_RBUTTONDOWN ) + return 0; + + return wxControl::MSWDefWindowProc(nMsg, wParam, lParam); +} + // process WM_NOTIFY Windows message bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) {