X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c33522fca7cddc441a316f5b9fb50d7685435ba..13cfc51d63509eb0da7d1cc1b9b291a4a701119f:/src/generic/vlbox.cpp?ds=inline diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp index 0d7f8ef199..13ce1b6278 100644 --- a/src/generic/vlbox.cpp +++ b/src/generic/vlbox.cpp @@ -261,15 +261,19 @@ bool wxVListBox::DoSetCurrent(int current) return true; } +void wxVListBox::InitEvent(wxCommandEvent& event, int n) +{ + event.SetEventObject(this); + event.SetInt(n); +} + void wxVListBox::SendSelectedEvent() { wxASSERT_MSG( m_current != wxNOT_FOUND, _T("SendSelectedEvent() shouldn't be called") ); wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId()); - event.SetEventObject(this); - event.SetInt(m_current); - + InitEvent(event, m_current); (void)GetEventHandler()->ProcessEvent(event); } @@ -708,9 +712,7 @@ void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse) if ( item == m_current ) { wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId()); - event.SetEventObject(this); - event.SetInt(item); - + InitEvent(event, item); (void)GetEventHandler()->ProcessEvent(event); } else