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
This commit is contained in:
@@ -1949,6 +1949,8 @@ void wxPGProperty::DeleteChoice( int index )
|
|||||||
|
|
||||||
int wxPGProperty::GetChoiceSelection() const
|
int wxPGProperty::GetChoiceSelection() const
|
||||||
{
|
{
|
||||||
|
wxASSERT_MSG( m_choices.IsOk(), wxT("No choices defined") );
|
||||||
|
|
||||||
wxVariant value = GetValue();
|
wxVariant value = GetValue();
|
||||||
wxString valueType = value.GetType();
|
wxString valueType = value.GetType();
|
||||||
int index = wxNOT_FOUND;
|
int index = wxNOT_FOUND;
|
||||||
@@ -1958,7 +1960,7 @@ int wxPGProperty::GetChoiceSelection() const
|
|||||||
|
|
||||||
if ( valueType == wxPG_VARIANT_TYPE_LONG )
|
if ( valueType == wxPG_VARIANT_TYPE_LONG )
|
||||||
{
|
{
|
||||||
index = value.GetLong();
|
index = m_choices.Index(value.GetLong());
|
||||||
}
|
}
|
||||||
else if ( valueType == wxPG_VARIANT_TYPE_STRING )
|
else if ( valueType == wxPG_VARIANT_TYPE_STRING )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user