diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 101cb91e60..cc5e30fe14 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -2390,7 +2390,7 @@ protected: /** Returns true if child property is selected. */ - bool IsChildSelected() const; + bool IsChildSelected( bool recursive = false ) const; // Removes child property with given pointer. Does not delete it. void RemoveChild( wxPGProperty* p ); diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 3ec89352eb..d0f4aa31fe 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -2569,12 +2569,19 @@ void wxPGProperty::DeleteChildren() } } -bool wxPGProperty::IsChildSelected() const +bool wxPGProperty::IsChildSelected( bool recursive ) const { size_t i; for ( i = 0; i < GetChildCount(); i++ ) { - if ( m_parentState->DoIsPropertySelected( Item(i) ) ) + wxPGProperty* child = Item(i); + + // Test child + if ( m_parentState->DoIsPropertySelected( child ) ) + return true; + + // Test sub-childs + if ( recursive && child->IsChildSelected( recursive ) ) return true; } diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 71a918aef1..5af8805a19 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -2600,7 +2600,7 @@ void wxPropertyGrid::DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 ) void wxPropertyGrid::RefreshProperty( wxPGProperty* p ) { - if ( m_pState->DoIsPropertySelected(p) || p->IsChildSelected() ) + if ( m_pState->DoIsPropertySelected(p) || p->IsChildSelected(true) ) { // NB: We must copy the selection. wxArrayPGProperty selection = m_pState->m_selection;