Use dedicated function to obtain highest level parent of the just changed property

This commit is contained in:
Artur Wieczorek
2018-10-13 11:37:27 +02:00
parent 7a7777cb4a
commit 7c0eac050e

View File

@@ -3368,14 +3368,6 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
// If property's value is being changed, assume it is valid // If property's value is being changed, assume it is valid
OnValidationFailureReset(selected); OnValidationFailureReset(selected);
wxPGProperty* topPaintedProperty = changedProperty;
while ( !topPaintedProperty->IsCategory() &&
!topPaintedProperty->IsRoot() )
{
topPaintedProperty = topPaintedProperty->GetParent();
}
changedProperty->SetValue(value, &m_chgInfo_valueList, wxPG_SETVAL_BY_USER); changedProperty->SetValue(value, &m_chgInfo_valueList, wxPG_SETVAL_BY_USER);
// NB: Call GetEditorControl() as late as possible, because OnSetValue() // NB: Call GetEditorControl() as late as possible, because OnSetValue()
@@ -3393,10 +3385,9 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
} }
} }
wxPGProperty* pwc;
// Propagate updates to parent(s) // Propagate updates to parent(s)
pwc = p; wxPGProperty* topPaintedProperty = changedProperty->GetMainParent();
wxPGProperty* pwc = p;
wxPGProperty* prevPwc = NULL; wxPGProperty* prevPwc = NULL;
while ( prevPwc != topPaintedProperty ) while ( prevPwc != topPaintedProperty )