From 2b9a7d4cc2f5f55df3d83f7cf2160cf9a509a4f2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 2 Apr 2005 13:48:56 +0000 Subject: [PATCH] fixed TREE_ITEM_MENU generation from right mouse clicks: don't pass WM_RBUTTONDOWN to tree control window proc git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/treectrl.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 8250f48782..4e277888cf 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2239,7 +2239,7 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara { bool processed = false; WXLRESULT rc = 0; - bool isMultiple = (GetWindowStyle() & wxTR_MULTIPLE) != 0; + bool isMultiple = HasFlag(wxTR_MULTIPLE); #ifdef WM_CONTEXTMENU if ( nMsg == WM_CONTEXTMENU ) @@ -2248,12 +2248,11 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara event.m_item = GetSelection(); event.SetEventObject( this ); if ( GetEventHandler()->ProcessEvent(event) ) - return true; + processed = true; //else: continue with generating wxEVT_CONTEXT_MENU in base class code } -#endif // __SMARTPHONE__ - - if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) ) +#endif // WM_CONTEXTMENU + else if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) ) { // we only process mouse messages here and these parameters have the // same meaning for all of them @@ -2276,6 +2275,13 @@ 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 @@ -2426,9 +2432,9 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara // TreeView_GetItemRect() will return false if item is not visible, // which may happen perfectly well if ( TreeView_GetItemRect(GetHwnd(), HITEM_PTR(selections[n]), - &rect, true) ) + &rect, TRUE) ) { - ::InvalidateRect(GetHwnd(), &rect, false); + ::InvalidateRect(GetHwnd(), &rect, FALSE); } } } -- 2.47.2