From 1d91908363c58e2c1ad38c550e6def0cca5a2e86 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 22 Oct 2010 16:33:29 +0000 Subject: [PATCH] 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 --- src/gtk/listbox.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 1bad9b14d7..5260617949 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -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 ); -- 2.45.2