Set wxLB_SINGLE style if no style is set.
Eat <Enter> presses so that no item gets unselected in single mode. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8601 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -195,6 +195,12 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
|
||||
ret = listbox->GetEventHandler()->ProcessEvent( new_event );
|
||||
}
|
||||
|
||||
if ((gdk_event->keyval == GDK_Return) && listbox->HasFlag(wxLB_SINGLE) && (!ret))
|
||||
{
|
||||
// eat return in single mode
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
if ((gdk_event->keyval == ' ') && (listbox->m_hasCheckBoxes) && (!ret))
|
||||
{
|
||||
@@ -311,11 +317,21 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
m_list = GTK_LIST( gtk_list_new() );
|
||||
|
||||
GtkSelectionMode mode = GTK_SELECTION_BROWSE;
|
||||
GtkSelectionMode mode;
|
||||
if (style & wxLB_MULTIPLE)
|
||||
{
|
||||
mode = GTK_SELECTION_MULTIPLE;
|
||||
}
|
||||
else if (style & wxLB_EXTENDED)
|
||||
{
|
||||
mode = GTK_SELECTION_EXTENDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if style was 0 set single mode
|
||||
m_windowStyle |= wxLB_SINGLE;
|
||||
mode = GTK_SELECTION_BROWSE;
|
||||
}
|
||||
|
||||
gtk_list_set_selection_mode( GTK_LIST(m_list), mode );
|
||||
|
||||
|
@@ -195,6 +195,12 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
|
||||
ret = listbox->GetEventHandler()->ProcessEvent( new_event );
|
||||
}
|
||||
|
||||
if ((gdk_event->keyval == GDK_Return) && listbox->HasFlag(wxLB_SINGLE) && (!ret))
|
||||
{
|
||||
// eat return in single mode
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
if ((gdk_event->keyval == ' ') && (listbox->m_hasCheckBoxes) && (!ret))
|
||||
{
|
||||
@@ -311,11 +317,21 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
m_list = GTK_LIST( gtk_list_new() );
|
||||
|
||||
GtkSelectionMode mode = GTK_SELECTION_BROWSE;
|
||||
GtkSelectionMode mode;
|
||||
if (style & wxLB_MULTIPLE)
|
||||
{
|
||||
mode = GTK_SELECTION_MULTIPLE;
|
||||
}
|
||||
else if (style & wxLB_EXTENDED)
|
||||
{
|
||||
mode = GTK_SELECTION_EXTENDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if style was 0 set single mode
|
||||
m_windowStyle |= wxLB_SINGLE;
|
||||
mode = GTK_SELECTION_BROWSE;
|
||||
}
|
||||
|
||||
gtk_list_set_selection_mode( GTK_LIST(m_list), mode );
|
||||
|
||||
|
Reference in New Issue
Block a user