m_strings = new wxSortedArrayString;
}
- // begin with no selection
- m_selection_hack = wxNOT_FOUND;
+ // If we have items, GTK will choose the first item by default
+ m_selection_hack = n > 0 ? 0 : wxNOT_FOUND;
GtkWidget *menu = gtk_menu_new();
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;
}