diff --git a/include/wx/mdi.h b/include/wx/mdi.h index 1f5d56e647..19a8832fb6 100644 --- a/include/wx/mdi.h +++ b/include/wx/mdi.h @@ -181,6 +181,11 @@ public: // return true. virtual bool IsTopNavigationDomain() const { return true; } + // Raising any frame is supposed to show it but wxFrame Raise() + // implementation doesn't work for MDI child frames in most forms so + // forward this to Activate() which serves the same purpose by default. + virtual void Raise() { Activate(); } + protected: wxMDIParentFrame *m_mdiParent; }; diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 5df2030341..0154cbdf1e 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1414,7 +1414,7 @@ void wxDocManager::ActivateDocument(wxDocument *doc) view->Activate(true); if ( wxWindow *win = view->GetFrame() ) - win->SetFocus(); + win->Raise(); } wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) diff --git a/src/osx/carbon/mdi.cpp b/src/osx/carbon/mdi.cpp index 216c16887e..80f31dc379 100644 --- a/src/osx/carbon/mdi.cpp +++ b/src/osx/carbon/mdi.cpp @@ -417,7 +417,9 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating) // MDI operations void wxMDIChildFrame::Activate() { - Raise (); + // The base class method calls Activate() so skip it to avoid infinite + // recursion and go directly to the real Raise() implementation. + wxFrame::Raise(); } //-----------------------------------------------------------------------------