diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index cbd2819bbe..3e4ccd26ca 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -142,9 +142,8 @@ public: // select the item which is diff items below the current one void ChangeCurrent(int diff); - // activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified or - // current (if -1) item - void Activate(int item = -1); + // activate (i.e. send a LISTBOX_DOUBLECLICKED message) the specified item + void Activate(int item); // select or unselect the specified or current (if -1) item void DoSelect(int item = -1, bool sel = true); diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index 0471a87290..b5bbb997c6 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -1078,27 +1078,22 @@ void wxListBox::DoSelect(int item, bool sel) void wxListBox::SelectAndNotify(int item) { - DoSelect(item); - - SendEvent(wxEVT_LISTBOX); + if( item != -1 ) + { + DoSelect(item); + SendEvent(wxEVT_LISTBOX); + } } void wxListBox::Activate(int item) { if ( item != -1 ) + { SetCurrentItem(item); - else - item = m_current; + if ( !(GetWindowStyle() & wxLB_MULTIPLE) ) + DeselectAll(item); - if ( !(GetWindowStyle() & wxLB_MULTIPLE) ) - { - DeselectAll(item); - } - - if ( item != -1 ) - { DoSelect(item); - SendEvent(wxEVT_LISTBOX_DCLICK); } }