From 7e1f1a13289c49100d011559e8bdc47d9c92024d Mon Sep 17 00:00:00 2001 From: Benjamin Williams Date: Tue, 7 Nov 2006 12:52:02 +0000 Subject: [PATCH] fixed event processing bug in tabmdi git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43157 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/aui/tabmdi.h | 5 +++-- src/aui/tabmdi.cpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/wx/aui/tabmdi.h b/include/wx/aui/tabmdi.h index 5f7d548bd1..f448605382 100644 --- a/include/wx/aui/tabmdi.h +++ b/include/wx/aui/tabmdi.h @@ -81,8 +81,9 @@ public: virtual void ActivatePrevious(); protected: - wxAuiMDIClientWindow *m_pClientWindow; - wxAuiMDIChildFrame *m_pActiveChild; + wxAuiMDIClientWindow* m_pClientWindow; + wxAuiMDIChildFrame* m_pActiveChild; + wxEvent* m_pLastEvt; #if wxUSE_MENUS wxMenu *m_pWindowMenu; diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 38ced9bfe4..572b09617c 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -173,14 +173,12 @@ void wxAuiMDIParentFrame::SetChildMenuBar(wxAuiMDIChildFrame* pChild) bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event) { - // Stops the same event being processed repeatedly - static wxEventType inEvent = wxEVT_NULL; - if (inEvent == event.GetEventType()) + // stops the same event being processed repeatedly + if (m_pLastEvt == &event) return false; - - inEvent = event.GetEventType(); - - // Let the active child (if any) process the event first. + m_pLastEvt = &event; + + // let the active child (if any) process the event first. bool res = false; if (m_pActiveChild && event.IsCommandEvent() && @@ -196,14 +194,15 @@ bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event) res = m_pActiveChild->GetEventHandler()->ProcessEvent(event); } - // If the event was not handled this frame will handle it! if (!res) { - //res = GetEventHandler()->ProcessEvent(event); + // if the event was not handled this frame will handle it, + // which is why we need the protection code at the beginning + // of this method res = wxEvtHandler::ProcessEvent(event); } - inEvent = wxEVT_NULL; + m_pLastEvt = NULL; return res; } @@ -255,6 +254,7 @@ void wxAuiMDIParentFrame::ActivatePrevious() void wxAuiMDIParentFrame::Init() { + m_pLastEvt = NULL; m_pClientWindow = NULL; m_pActiveChild = NULL; #if wxUSE_MENUS -- 2.45.2