]> git.saurik.com Git - wxWidgets.git/commitdiff
Fully conform to the documented statement according to which names of properties...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 20 Dec 2008 16:01:13 +0000 (16:01 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 20 Dec 2008 16:01:13 +0000 (16:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/propgridpagestate.cpp

index 6e4e78d65e7a43bd0dd1fe71b6803da34c5214d5..a2ce40e1ed65c94e70e0f07ed570530c125033a4 100644 (file)
@@ -453,8 +453,15 @@ void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p,
 {
     wxCHECK_RET( p, wxT("invalid property id") );
 
-    if ( p->GetBaseName().Len() ) m_dictName.erase( p->GetBaseName() );
-    if ( newName.Len() ) m_dictName[newName] = (void*) p;
+    wxPGProperty* parent = p->GetParent();
+
+    if ( parent->IsCategory() || parent->IsRoot() )
+    {
+        if ( p->GetBaseName().length() )
+            m_dictName.erase( p->GetBaseName() );
+        if ( newName.length() )
+            m_dictName[newName] = (void*) p;
+    }
 
     p->DoSetName(newName);
 }
@@ -1676,7 +1683,8 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
     }
 
     // Only add name to hashmap if parent is root or category
-    if ( (parent->IsCategory() || parent->IsRoot()) && property->m_name.length() )
+    if ( property->m_name.length() &&
+        (parent->IsCategory() || parent->IsRoot()) )
         m_dictName[property->m_name] = (void*) property;
 
     VirtualHeightChanged();
@@ -1771,7 +1779,9 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
         }
     }
 
-    if ( item->GetBaseName().Len() ) m_dictName.erase(item->GetBaseName());
+    if ( item->GetBaseName().length() && 
+         (parent->IsCategory() || parent->IsRoot()) )
+        m_dictName.erase(item->GetBaseName());
 
     // We can actually delete it now
     if ( doDelete )