From 97713c12d7666a8da4497c01b3298885b955052b Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 11 Jul 2016 21:27:42 +0200 Subject: [PATCH] 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. --- src/propgrid/propgridiface.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 52c10de16c..6085f50a22 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -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 ); + } } }