From 261a9107f0ce372c61b1e8c634e98cf7ad59a91e Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 19 Sep 2007 13:55:24 +0000 Subject: [PATCH] GTK+ selects the first item initially, II git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/choice.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index b63c3c68bc..2e160d2287 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -163,6 +163,12 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, m_selection_hack += count; } + // We must set the selection so that it can be read back even if + // the user has not modified it since GTK+ will then select the + // first item so well return 0. + if ((count > 0) && (m_selection_hack==wxNOT_FOUND)) + m_selection_hack = 0; + return pos - 1; } -- 2.45.2