diff --git a/docs/changes.txt b/docs/changes.txt index 22a81ecfe4..f67bb72fd8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -602,6 +602,7 @@ All (GUI): - Fix wxGraphicsBitmap::ConvertToImage() when using Cairo. - Support loading ICO files with data in PNG format (Artur Wieczorek). - Fix dragging columns in wxGrid when some of them are hidden (Artur Wieczorek). +- Fix selecting elements from wxPropertyGrid enum properties (Artur Wieczorek). wxGTK: diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 3b0d7973fe..1ed738945e 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -1176,7 +1176,7 @@ bool wxPGChoiceEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* pr property->IsValueUnspecified() ) { - return property->IntToValue( variant, index, 0 ); + return property->IntToValue(variant, index, wxPG_PROPERTY_SPECIFIC); } return false; } @@ -1699,7 +1699,7 @@ bool wxPGCheckBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* property->IsValueUnspecified() ) { - return property->IntToValue(variant, index, 0); + return property->IntToValue(variant, index, wxPG_PROPERTY_SPECIFIC); } return false; } diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index bfe04e9578..69d136813b 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -1185,22 +1185,27 @@ bool wxEnumProperty::ValueFromInt_( wxVariant& variant, int intVal, int argFlags { // If wxPG_FULL_VALUE is *not* in argFlags, then intVal is index from combo box. // - ms_nextIndex = -2; + int setAsNextIndex = -2; if ( argFlags & wxPG_FULL_VALUE ) { - ms_nextIndex = GetIndexForValue( intVal ); + setAsNextIndex = GetIndexForValue( intVal ); } else { if ( intVal != GetIndex() ) { - ms_nextIndex = intVal; + setAsNextIndex = intVal; } } - if ( ms_nextIndex != -2 ) + if ( setAsNextIndex != -2 ) { + // If wxPG_PROPERTY_SPECIFIC is set, then this is done for + // validation or fetching a data purposes only, and index must not be changed. + if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) ) + ms_nextIndex = setAsNextIndex; + if ( !(argFlags & wxPG_FULL_VALUE) ) intVal = m_choices.GetValue(intVal);