]> git.saurik.com Git - wxWidgets.git/commitdiff
Set focus back to canvas when child editors are being destroyed (fixes wxGTK property...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 12 Oct 2008 11:13:21 +0000 (11:13 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 12 Oct 2008 11:13:21 +0000 (11:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/propgrid.cpp

index 021f77cd5f859536f89077d2ced4eb78b48b0253..2fbaf765343e86d8d86090b7309c9fd20c745062 100644 (file)
@@ -3458,6 +3458,25 @@ void wxPropertyGrid::SetupChildEventHandling( wxWindow* argWnd )
 
 void wxPropertyGrid::FreeEditors()
 {
+    //
+    // Return focus back to canvas from children (this is required at least for
+    // GTK+, which, unlike Windows, clears focus when control is destroyed
+    // instead of moving it to closest parent).
+    wxWindow* focus = wxWindow::FindFocus();
+    if ( focus )
+    {
+        wxWindow* parent = focus->GetParent();
+        while ( parent )
+        {
+            if ( parent == m_canvas )
+            {
+                SetFocusOnCanvas();
+                break;
+            }
+            parent = parent->GetParent();
+        }
+    }
+
     // Do not free editors immediately if processing events
     if ( m_wndEditor2 )
     {