Applied patch for wxComboBox and wxListBox to

prevent "hanging" in single selection mode.
    Also removed call to AddPendingEvent and
    changed wxLB_EXTENDED mode so that no changes
    to the listbox go unnoticed.
  I do wonder what the difference between multiple
    and extended list boxes actually are.
  Not suer what I changed in the other files.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11310 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2001-08-06 21:06:13 +00:00
parent 1bcfc0e1b9
commit 159b66c02a
10 changed files with 94 additions and 14 deletions

View File

@@ -57,8 +57,18 @@ gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
combo->m_alreadySent = TRUE;
int curSelection = combo->GetSelection();
if (combo->m_prevSelection != curSelection)
{
GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
}
combo->m_prevSelection = curSelection;
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
event.SetInt( combo->GetSelection() );
event.SetInt( curSelection );
event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
@@ -102,6 +112,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
m_alreadySent = FALSE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
@@ -121,6 +132,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );
for (int i = 0; i < n; i++)
{
/* don't send first event, which GTK sends aways when
@@ -433,7 +446,9 @@ void wxComboBox::SetSelection( int n )
DisableEvents();
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_unselect_item( GTK_LIST(list), m_prevSelection );
gtk_list_select_item( GTK_LIST(list), n );
m_prevSelection = n;
EnableEvents();
}