From 2d1715aa46b210e69ddf2dd1cd1c7d2f23c4298a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 Feb 2004 15:38:54 +0000 Subject: [PATCH] fixed wxEVT_CONTEXT_MENU generation (it works differently under w2k/XP than under NT4 apparently...) (partly fixes bug 861510) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 91116b67ac..eb062f0102 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2866,8 +2866,20 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam wxPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU, GetId(), pt); - evtCtx.SetEventObject(this); - processed = GetEventHandler()->ProcessEvent(evtCtx); + + // we could have got an event from our child, reflect it back + // to it if this is the case + wxWindow *win = NULL; + if ( wParam != m_hWnd ) + { + win = FindItemByHWND((WXHWND)wParam); + } + + if ( !win ) + win = this; + + evtCtx.SetEventObject(win); + processed = win->GetEventHandler()->ProcessEvent(evtCtx); } break; #endif