]> git.saurik.com Git - wxWidgets.git/commitdiff
better handling situation when active frame is destroyed or hidden
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 17 Mar 2002 21:44:31 +0000 (21:44 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 17 Mar 2002 21:44:31 +0000 (21:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/window.cpp

index f7423ea103a0e24a89e73abf83e7e8442ae58414..36baf4f2cba6114eddedaeeabd38926c94e45880 100644 (file)
@@ -569,12 +569,17 @@ wxWindowMGL::~wxWindowMGL()
 
     if (gs_activeFrame == this)
     {
-       gs_activeFrame = NULL;
-       // activate next frame in Z-order:
-       if ( m_wnd->prev )
-       {
-           wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData;
-           win->SetFocus();
+        gs_activeFrame = NULL;
+        // activate next frame in Z-order:
+        if ( m_wnd->prev )
+        {
+            wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData;
+            win->SetFocus();
+        }
+        else if ( m_wnd->next )
+        {
+            wxWindowMGL *win = (wxWindowMGL*)m_wnd->next->userData;
+            win->SetFocus();
         }
     }
     
@@ -760,11 +765,20 @@ bool wxWindowMGL::Show(bool show)
     
     if (!show && gs_activeFrame == this)
     {
-       // activate next frame in Z-order:
-       if ( m_wnd->prev )
-       {
-           wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData;
-           win->SetFocus();
+        // activate next frame in Z-order:
+        if ( m_wnd->prev )
+        {
+            wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData;
+            win->SetFocus();
+        }
+        else if ( m_wnd->next )
+        {
+            wxWindowMGL *win = (wxWindowMGL*)m_wnd->next->userData;
+            win->SetFocus();
+        }
+        else
+        {
+            gs_activeFrame = NULL;
         }
     }