diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 42ee76c319..12d3ae3b8d 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1047,15 +1047,13 @@ wxVariant wxSystemColourProperty::DoTranslateVal( wxColourPropertyValue& v ) con int wxSystemColourProperty::ColToInd( const wxColour& colour ) const { - size_t i; - size_t i_max = m_choices.GetCount(); - - if ( !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) ) - i_max -= 1; - - for ( i=0; iFind(*colourLabels); - // Use standard wx colour value if its label was found, - // otherwise register custom PG colour. - if ( !clr.IsOk() ) + // Don't take into account user-defined custom colour. + if (gs_cp_es_normcolour_values[i] != wxPG_COLOUR_CUSTOM) { - clr.Set(gs_cp_es_normcolour_colours[i]); - wxTheColourDatabase->AddColour(*colourLabels, clr); + wxColour clr = wxTheColourDatabase->Find(*colourLabels); + // Use standard wx colour value if its label was found, + // otherwise register custom PG colour. + if ( !clr.IsOk() ) + { + clr.Set(gs_cp_es_normcolour_colours[i]); + wxTheColourDatabase->AddColour(*colourLabels, clr); + } } } }