Update controls sample to follow documented logic
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
22892deac9
commit
0f252d1171
@ -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() );
|
||||
|
Loading…
Reference in New Issue
Block a user