]> git.saurik.com Git - wxWidgets.git/commitdiff
Have DoRemoveFromSelection() take active editor into account
authorJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 19 Aug 2009 14:09:33 +0000 (14:09 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 19 Aug 2009 14:09:33 +0000 (14:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61711 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/propgridpagestate.cpp

index fa4d8cf261cc5d62261df77f2c1a0ac6acb1c726..319878350bd56ce280cbc957502ff06a2ad7bc54 100644 (file)
@@ -1218,7 +1218,31 @@ void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty* prop )
     {
         if ( m_selection[i] == prop )
         {
-            m_selection.erase( m_selection.begin() + i );
+            wxPropertyGrid* pg = m_pPropGrid;
+            if ( i == 0 && pg->GetState() == this )
+            {
+                // If first item (ie. one with the active editor) was
+                // deselected, then we need to take some extra measures.
+                wxArrayPGProperty sel = m_selection;
+                sel.erase( sel.begin() + i );
+
+                wxPGProperty* newFirst;
+                if ( sel.size() )
+                    newFirst = sel[0];
+                else
+                    newFirst = NULL;
+
+                pg->DoSelectProperty(newFirst,
+                                     wxPG_SEL_DONT_SEND_EVENT);
+
+                m_selection = sel;
+
+                pg->Refresh();
+            }
+            else
+            {
+                m_selection.erase( m_selection.begin() + i );
+            }
             return;
         }
     }