A single-selection listbox must always have a selected item, at least after
initial selection is done, i.e. its selected item can't be deselected. This
behaviour corresponds to GTK_SELECTION_BROWSE style in GTK+.
Closes #2549.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65865
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
else // no multi-selection flags specified
{
m_windowStyle |= wxLB_SINGLE;
- mode = GTK_SELECTION_SINGLE;
+
+ // Notice that we must use BROWSE and not GTK_SELECTION_SINGLE because
+ // the latter allows to not select any items at all while a single
+ // selection listbox is supposed to always have a selection (at least
+ // once the user selected something, it might not have any initially).
+ mode = GTK_SELECTION_BROWSE;
}
GtkTreeSelection* selection = gtk_tree_view_get_selection( m_treeview );