fixed event processing bug in tabmdi

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43157 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams
2006-11-07 12:52:02 +00:00
parent 8896cb72d2
commit 7e1f1a1328
2 changed files with 13 additions and 12 deletions

View File

@@ -81,8 +81,9 @@ public:
virtual void ActivatePrevious(); virtual void ActivatePrevious();
protected: protected:
wxAuiMDIClientWindow *m_pClientWindow; wxAuiMDIClientWindow* m_pClientWindow;
wxAuiMDIChildFrame *m_pActiveChild; wxAuiMDIChildFrame* m_pActiveChild;
wxEvent* m_pLastEvt;
#if wxUSE_MENUS #if wxUSE_MENUS
wxMenu *m_pWindowMenu; wxMenu *m_pWindowMenu;

View File

@@ -173,14 +173,12 @@ void wxAuiMDIParentFrame::SetChildMenuBar(wxAuiMDIChildFrame* pChild)
bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event) bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event)
{ {
// Stops the same event being processed repeatedly // stops the same event being processed repeatedly
static wxEventType inEvent = wxEVT_NULL; if (m_pLastEvt == &event)
if (inEvent == event.GetEventType())
return false; return false;
m_pLastEvt = &event;
inEvent = event.GetEventType();
// let the active child (if any) process the event first.
// Let the active child (if any) process the event first.
bool res = false; bool res = false;
if (m_pActiveChild && if (m_pActiveChild &&
event.IsCommandEvent() && event.IsCommandEvent() &&
@@ -196,14 +194,15 @@ bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event)
res = m_pActiveChild->GetEventHandler()->ProcessEvent(event); res = m_pActiveChild->GetEventHandler()->ProcessEvent(event);
} }
// If the event was not handled this frame will handle it!
if (!res) 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); res = wxEvtHandler::ProcessEvent(event);
} }
inEvent = wxEVT_NULL; m_pLastEvt = NULL;
return res; return res;
} }
@@ -255,6 +254,7 @@ void wxAuiMDIParentFrame::ActivatePrevious()
void wxAuiMDIParentFrame::Init() void wxAuiMDIParentFrame::Init()
{ {
m_pLastEvt = NULL;
m_pClientWindow = NULL; m_pClientWindow = NULL;
m_pActiveChild = NULL; m_pActiveChild = NULL;
#if wxUSE_MENUS #if wxUSE_MENUS