From 91144a22472526dc47b9cf5c566e7c5b24ac26ab Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 10 May 2015 18:25:30 +0200 Subject: [PATCH] Fixed setting property label with wxPGproperty::SetLabel If there is a corresponding cell containing a cached text for column 0 then this text also needs to be updated when the label is changed. See #16982. --- include/wx/propgrid/property.h | 2 +- src/propgrid/property.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 9d9b49f4ad..e0e6050315 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -2128,7 +2128,7 @@ public: m_helpString = helpString; } - void SetLabel( const wxString& label ) { m_label = label; } + void SetLabel( const wxString& label ); void SetName( const wxString& newName ); diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 339da1111b..af9225640e 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -705,6 +705,20 @@ bool wxPGProperty::IsSomeParent( wxPGProperty* candidate ) const return false; } +void wxPGProperty::SetLabel(const wxString& label) +{ + m_label = label; + // Update cell text if possible + if ( HasCell(0) ) + { + wxPGCell& cell = GetCell(0); + if ( cell.HasText() ) + { + cell.SetText(label); + } + } +} + void wxPGProperty::SetName( const wxString& newName ) { wxPropertyGrid* pg = GetGrid();