Always redraw wxPGProperty after changing its attribute
Because changing some attributes of the property affects the format of displayed value so the property has to be refreshed whether its attribute is set through wxPGProperty::SetAttribute() or wxPropertyGridInterface::SetPropertyAttribute(). Closes #18388.
This commit is contained in:
@@ -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 )
|
||||
|
@@ -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 )
|
||||
{
|
||||
|
Reference in New Issue
Block a user