Determine better whether the property editor needs to be refreshed in wxPGProperty::SetValue()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli 2009-12-14 15:33:50 +00:00
parent b5aaf62e97
commit 5ff9067686

View File

@ -1366,18 +1366,25 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
UpdateParentValues(); UpdateParentValues();
// //
// Update editor control // Update editor control.
//
// We need to check for these, otherwise GetGrid() may fail.
if ( flags & wxPG_SETVAL_REFRESH_EDITOR ) if ( flags & wxPG_SETVAL_REFRESH_EDITOR )
{ {
RefreshEditor();
wxPropertyGrid* pg = GetGridIfDisplayed(); wxPropertyGrid* pg = GetGridIfDisplayed();
if ( pg ) if ( pg )
{
wxPGProperty* selected = pg->GetSelectedProperty();
// Only refresh the control if this was selected, or
// this was some parent of selected, or vice versa)
if ( selected && (selected == this ||
selected->IsSomeParent(this) ||
this->IsSomeParent(selected)) )
RefreshEditor();
pg->DrawItemAndValueRelated(this); pg->DrawItemAndValueRelated(this);
} }
} }
}
void wxPGProperty::SetValueInEvent( wxVariant value ) const void wxPGProperty::SetValueInEvent( wxVariant value ) const