From 8fd38e3369aa4494ca7c2429d5010b5c44471338 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Wed, 13 Apr 2011 16:35:59 +0000 Subject: [PATCH 1/1] Completely re-construct the wxComboCtrl textctrl-events instead of just redirecting them git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/combocmn.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index bf1ad43c3a..afd9a7e4f8 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1754,6 +1754,13 @@ void wxComboCtrlBase::RecalcAndRefresh() void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) { + // Avoid infinite recursion + if ( event.GetEventObject() == this ) + { + event.Skip(); + return; + } + if ( event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED ) { if ( m_ignoreEvtText > 0 ) @@ -1763,12 +1770,13 @@ void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) } } - // Change event id, object and string before relaying it forward - event.SetId(GetId()); - wxString s = event.GetString(); - event.SetEventObject(this); - event.SetString(s); - event.Skip(); + event.StopPropagation(); + + // For safety, completely re-create a new wxCommandEvent + wxCommandEvent evt2(event.GetEventType(), GetId()); + evt2.SetEventObject(this); + evt2.SetString(event.GetString()); + HandleWindowEvent(evt2); } // call if cursor is on button area or mouse is captured for the button -- 2.45.2