]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix showing MDI child from wxDocManager::ActivateDocument().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Mar 2012 00:29:03 +0000 (00:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Mar 2012 00:29:03 +0000 (00:29 +0000)
This fix has 2 components: first, call Raise() instead of simple SetFocus()
from ActivateDocument() as this corresponds better to what we want to do here.
And second, override Raise() to call Activate() in wxMDIChildFrame to ensure
that it works as expected as raising an MDI child doesn't work otherwise in
most ports (with the exceptions for wxOSX which, on the contrary, needs a
small fix to preserve the existing working Raise() behaviour).

Closes #13946.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70790 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mdi.h
src/common/docview.cpp
src/osx/carbon/mdi.cpp

index 1f5d56e6474a3985632b7175c4bc711653fff87d..19a8832fb643b8672f00c1e51653370c5e0c3d78 100644 (file)
@@ -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;
 };
index 5df20303415862c9abaf33c29b9518b869c96a3d..0154cbdf1e80d09337faf21e4d73318a2b08297b 100644 (file)
@@ -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)
index 216c16887e312753cb67cf6949ce50732d5d98b5..80f31dc379d45409f3389d4143b05f0678c0eab7 100644 (file)
@@ -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();
 }
 
 //-----------------------------------------------------------------------------