]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixes for forwarding events to parent in wxGenericListCtrl.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Aug 2012 11:34:43 +0000 (11:34 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Aug 2012 11:34:43 +0000 (11:34 +0000)
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

src/generic/listctrl.cpp

index e41e9ce95dad3ca6bd7d9eaa4fa5fe80de1288cf..e8e6b26b34c125b32bb168797631766b90eb827b 100644 (file)
@@ -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;