diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 700eef79ac..9cc04632b3 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1855,14 +1855,19 @@ bool wxPGProperty::DoSetAttribute( const wxString& WXUNUSED(name), wxVariant& WX void wxPGProperty::SetAttribute( const wxString& name, wxVariant value ) { - if ( DoSetAttribute( name, value ) ) + if ( !DoSetAttribute(name, value) || !wxPGGlobalVars->HasExtraStyle(wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES) ) { - // Support working without grid, when possible - if ( wxPGGlobalVars->HasExtraStyle( wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES ) ) - return; + m_attributes.Set(name, value); + } + // Because changing some attributes (like wxPG_FLOAT_PRECISION, wxPG_UINT_BASE, + // wxPG_UINT_PREFIX, wxPG_ATTR_UNITS) affect displayed form of the property value + // so we have to redraw property to be sure that displayed value is in sync + // with current attributes. + wxPropertyGrid* pg = GetGridIfDisplayed(); + if ( pg ) + { + pg->RefreshProperty(this); } - - m_attributes.Set( name, value ); } void wxPGProperty::SetAttributes( const wxPGAttributeStorage& attributes ) diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 1b7f3c802b..2d294cd0d5 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -452,13 +452,7 @@ void wxPropertyGridInterface::DoSetPropertyAttribute( wxPGPropArg id, const wxSt { wxPG_PROP_ARG_CALL_PROLOG() - p->SetAttribute( name, value ); - // If property is attached to the property grid - // then refresh the view. - if( p->GetParentState() ) - { - RefreshProperty( p ); - } + p->SetAttribute( name, value ); // property is also refreshed here if ( argFlags & wxPG_RECURSE ) {