Fixed setting wxPGProperty label

If wxPropertyGrid has wxPG_AUTO_SORT flag set then renaming the label of any property can change the order of displayed properties including this one which is currently selected. To be properly displayed in the new location this selected property has to be refreshed separately.
This commit is contained in:
Artur Wieczorek 2016-07-11 21:27:42 +02:00
parent d6a6b8fbd4
commit 97713c12d7

View File

@ -635,6 +635,9 @@ void wxPropertyGridInterface::SetPropertyLabel( wxPGPropArg id, const wxString&
{
wxPG_PROP_ARG_CALL_PROLOG()
if ( p->GetLabel() == newproplabel )
return;
p->SetLabel( newproplabel );
wxPropertyGridPageState* state = p->GetParentState();
@ -646,9 +649,19 @@ void wxPropertyGridInterface::SetPropertyLabel( wxPGPropArg id, const wxString&
if ( pg->GetState() == state )
{
if ( pg->HasFlag(wxPG_AUTO_SORT) )
{
pg->Refresh();
// If any property is selected it has to
// be refreshed in the new location.
if ( pg == p->GetGrid() && pg->GetSelectedProperty() )
{
RefreshProperty(pg->GetSelectedProperty());
}
}
else
{
pg->DrawItem( p );
}
}
}