From: Robert Roebling Date: Fri, 23 May 2008 11:04:37 +0000 (+0000) Subject: Update controls sample to follow documented logic X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0f252d1171a251d375ca41ccc33aee88d647fc7d Update controls sample to follow documented logic git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 0b9b11546d..6cd37657df 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -1191,22 +1191,24 @@ void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event)) void MyPanel::OnListBox( wxCommandEvent &event ) { - if (event.GetInt() == -1) - { - m_text->AppendText( _T("ListBox has no selections anymore\n") ); - return; - } - wxListBox *listbox = event.GetId() == ID_LISTBOX ? m_listbox : m_listboxSorted; + bool deselect = false; + if (listbox->HasFlag(wxLB_MULTIPLE) || listbox->HasFlag(wxLB_EXTENDED)) + { + deselect = !event.IsSelection(); + if (deselect) + m_text->AppendText( _T("ListBox deselection event\n") ); + } + m_text->AppendText( _T("ListBox event selection string is: '") ); m_text->AppendText( event.GetString() ); m_text->AppendText( _T("'\n") ); // can't use GetStringSelection() with multiple selections, there could be // more than one of them - if ( !listbox->HasFlag(wxLB_MULTIPLE) ) + if ( !listbox->HasFlag(wxLB_MULTIPLE) && !listbox->HasFlag(wxLB_EXTENDED) ) { m_text->AppendText( _T("ListBox control selection string is: '") ); m_text->AppendText( listbox->GetStringSelection() );