From 74fe278740213d1f64b46dc106328f6675c6e055 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 14 May 2009 12:45:20 +0000 Subject: [PATCH] Fixed event propagation problems in wxMac native list control git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@60636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 4 ++++ src/mac/carbon/listctrl_mac.cpp | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 61d7cd2311..97f705ecc7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -117,7 +117,11 @@ wxMSW: - Fixed generation of wxEVT_CHAR_HOOK events. - Implement wxFileName::SetTimes() for directories (Steve Lamerton). +wxMac: +- Fixed a problem with wxListCtrl whereby event processing would change + the event object identifier, and thereby affect subsequent processing, + and defeat custom event propagation of commands from current focus window. 2.8.10: ------- diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index 2e2334570c..db432b2eba 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -303,6 +303,9 @@ wxMacListCtrlEventDelegate::wxMacListCtrlEventDelegate( wxListCtrl* list, int id bool wxMacListCtrlEventDelegate::ProcessEvent( wxEvent& event ) { + int id = event.GetId(); + wxObject* obj = event.GetEventObject(); + // even though we use a generic list ctrl underneath, make sure // we present ourselves as wxListCtrl. event.SetEventObject( m_list ); @@ -311,9 +314,19 @@ bool wxMacListCtrlEventDelegate::ProcessEvent( wxEvent& event ) if ( !event.IsKindOf( CLASSINFO( wxCommandEvent ) ) ) { if (m_list->GetEventHandler()->ProcessEvent( event )) + { + event.SetId(id); + event.SetEventObject(obj); return true; + } } - return wxEvtHandler::ProcessEvent(event); + // Also try with the original id + bool success = wxEvtHandler::ProcessEvent(event); + event.SetId(id); + event.SetEventObject(obj); + if (!success && id != m_id) + success = wxEvtHandler::ProcessEvent(event); + return success; } //-----------------------------------------------------------------------------