From: Vadim Zeitlin Date: Wed, 15 Aug 2012 11:34:43 +0000 (+0000) Subject: Fixes for forwarding events to parent in wxGenericListCtrl. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/524a2c6e51b2e14758ee9dcd51fc3922198b5d13 Fixes for forwarding events to parent in wxGenericListCtrl. Set the event object and the event ID correctly, i.e. to the values corresponding to the main wxListCtrl itself, when forwarding mouse and keyboard events from wxListMainWindow to wxListCtrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index e41e9ce95d..e8e6b26b34 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2302,8 +2302,11 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) if ( event.LeftDown() ) SetFocus(); - event.SetEventObject( GetParent() ); - if ( GetParent()->GetEventHandler()->ProcessEvent( event) ) + // Pretend that the event happened in wxListCtrl itself. + wxMouseEvent me(event); + me.SetEventObject( GetParent() ); + me.SetId(GetParent()->GetId()); + if ( GetParent()->GetEventHandler()->ProcessEvent( me )) return; if (event.GetEventType() == wxEVT_MOUSEWHEEL) @@ -2705,6 +2708,7 @@ void wxListMainWindow::OnKeyDown( wxKeyEvent &event ) // propagate the key event upwards wxKeyEvent ke(event); ke.SetEventObject( parent ); + ke.SetId(GetParent()->GetId()); if (parent->GetEventHandler()->ProcessEvent( ke )) return; @@ -2728,6 +2732,8 @@ void wxListMainWindow::OnKeyUp( wxKeyEvent &event ) // propagate the key event upwards wxKeyEvent ke(event); + ke.SetEventObject( parent ); + ke.SetId(GetParent()->GetId()); if (parent->GetEventHandler()->ProcessEvent( ke )) return; @@ -2757,6 +2763,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) // propagate the char event upwards wxKeyEvent ke(event); ke.SetEventObject( parent ); + ke.SetId(GetParent()->GetId()); if (parent->GetEventHandler()->ProcessEvent( ke )) return;