From 0f9ba6c59f5e5a29885e3fc917a16331ddeb4eda Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 6 Aug 2014 13:26:00 +0000 Subject: [PATCH] Fix wxPGProperty::GetChoiceSelection Return the index of the integer choice item on the list instead of item value itself. See #16401. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/property.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 2f5228fbb3..9e012baaba 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -1949,6 +1949,8 @@ void wxPGProperty::DeleteChoice( int index ) int wxPGProperty::GetChoiceSelection() const { + wxASSERT_MSG( m_choices.IsOk(), wxT("No choices defined") ); + wxVariant value = GetValue(); wxString valueType = value.GetType(); int index = wxNOT_FOUND; @@ -1958,7 +1960,7 @@ int wxPGProperty::GetChoiceSelection() const if ( valueType == wxPG_VARIANT_TYPE_LONG ) { - index = value.GetLong(); + index = m_choices.Index(value.GetLong()); } else if ( valueType == wxPG_VARIANT_TYPE_STRING ) {