Use GTK_SELECTION_BROWSE instead of SINGLE for wxListBox in wxGTK.

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
This commit is contained in:
Vadim Zeitlin
2010-10-22 16:33:29 +00:00
parent a0fe77034b
commit 1d91908363

View File

@@ -430,7 +430,12 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
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 );