decouple item index from string value (patch 1905702)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -212,6 +212,8 @@ private:
|
|||||||
// Partial completion string
|
// Partial completion string
|
||||||
wxString m_partialCompletionString;
|
wxString m_partialCompletionString;
|
||||||
|
|
||||||
|
wxString m_stringValue;
|
||||||
|
|
||||||
#if wxUSE_TIMER
|
#if wxUSE_TIMER
|
||||||
// Partial completion timer
|
// Partial completion timer
|
||||||
wxTimer m_partialCompletionTimer;
|
wxTimer m_partialCompletionTimer;
|
||||||
|
@@ -209,17 +209,16 @@ void wxVListBoxComboPopup::DismissWithEvent()
|
|||||||
|
|
||||||
Dismiss();
|
Dismiss();
|
||||||
|
|
||||||
wxString valStr;
|
|
||||||
if ( selection != wxNOT_FOUND )
|
if ( selection != wxNOT_FOUND )
|
||||||
valStr = m_strings[selection];
|
m_stringValue = m_strings[selection];
|
||||||
else
|
else
|
||||||
valStr = wxEmptyString;
|
m_stringValue = wxEmptyString;
|
||||||
|
|
||||||
|
if ( m_stringValue != m_combo->GetValue() )
|
||||||
|
m_combo->SetValueWithEvent(m_stringValue);
|
||||||
|
|
||||||
m_value = selection;
|
m_value = selection;
|
||||||
|
|
||||||
if ( valStr != m_combo->GetValue() )
|
|
||||||
m_combo->SetValueWithEvent(valStr);
|
|
||||||
|
|
||||||
SendComboBoxEvent(selection);
|
SendComboBoxEvent(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,9 +608,7 @@ void wxVListBoxComboPopup::SetString( int item, const wxString& str )
|
|||||||
|
|
||||||
wxString wxVListBoxComboPopup::GetStringValue() const
|
wxString wxVListBoxComboPopup::GetStringValue() const
|
||||||
{
|
{
|
||||||
if ( m_value >= 0 )
|
return m_stringValue;
|
||||||
return m_strings[m_value];
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxVListBoxComboPopup::SetSelection( int item )
|
void wxVListBoxComboPopup::SetSelection( int item )
|
||||||
@@ -621,6 +618,11 @@ void wxVListBoxComboPopup::SetSelection( int item )
|
|||||||
|
|
||||||
m_value = item;
|
m_value = item;
|
||||||
|
|
||||||
|
if ( item >= 0 )
|
||||||
|
m_stringValue = m_strings[item];
|
||||||
|
else
|
||||||
|
m_stringValue = wxEmptyString;
|
||||||
|
|
||||||
if ( IsCreated() )
|
if ( IsCreated() )
|
||||||
wxVListBox::SetSelection(item);
|
wxVListBox::SetSelection(item);
|
||||||
}
|
}
|
||||||
@@ -634,10 +636,13 @@ void wxVListBoxComboPopup::SetStringValue( const wxString& value )
|
|||||||
{
|
{
|
||||||
int index = m_strings.Index(value);
|
int index = m_strings.Index(value);
|
||||||
|
|
||||||
m_value = index;
|
m_stringValue = value;
|
||||||
|
|
||||||
if ( index >= -1 && index < (int)wxVListBox::GetItemCount() )
|
if ( index >= 0 && index < (int)wxVListBox::GetItemCount() )
|
||||||
|
{
|
||||||
wxVListBox::SetSelection(index);
|
wxVListBox::SetSelection(index);
|
||||||
|
m_value = index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxVListBoxComboPopup::CalcWidths()
|
void wxVListBoxComboPopup::CalcWidths()
|
||||||
|
Reference in New Issue
Block a user