From 71dd05d58a244cbecb5d69f760601e39698a2bee Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 3 Sep 2010 19:33:18 +0000 Subject: [PATCH] Fix wxOwnerDrawnComboBox keyboard navigation with duplicate items. If the combobox contained duplicate strings (i.e. multiple items with the same string value, but differing indexes), then navigating to the second and subsequent ones skipped to the first occurence instead. We need to preserve the index. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/odcombo.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 47b567d1ef..fb9d6b43af 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -370,11 +370,15 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar keychar // (good for consistency) return true; - m_value = value; - if ( value >= 0 ) m_combo->SetValue(m_strings[value]); + // The m_combo->SetValue() call above sets m_value to the index of this + // string. But if there are more identical string, the index is of the + // first occurence, which may be wrong, so set the index explicitly here, + // _after_ the SetValue() call. + m_value = value; + SendComboBoxEvent(m_value); return true; -- 2.45.2