git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2013-02-14 08:07:24 +00:00
parent 1fd850ab55
commit 116d7e5805

View File

@@ -2050,21 +2050,23 @@ void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event)
void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event )
{ {
// On Mac, this leads to infinite recursion and eventually a crash // On Mac, setting focus here leads to infinite recursion and eventually
#ifdef __WXMAC__ // a crash due to the SetFocus call producing another event.
wxUnusedVar(event); // Handle Mac in OnIdleEvent using m_resetFocus.
#else
if ( event.GetEventType() == wxEVT_SET_FOCUS ) if ( event.GetEventType() == wxEVT_SET_FOCUS )
{ {
wxWindow* tc = GetTextCtrl(); if ( GetTextCtrl() && !GetTextCtrl()->HasFocus() )
if ( tc && tc != DoFindFocus() )
{ {
tc->SetFocus(); #ifdef __WXMAC__
m_resetFocus = true;
#else
GetTextCtrl()->SetFocus();
#endif
} }
} }
Refresh(); Refresh();
#endif
} }
void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) ) void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) )
@@ -2072,9 +2074,8 @@ void wxComboCtrlBase::OnIdleEvent( wxIdleEvent& WXUNUSED(event) )
if ( m_resetFocus ) if ( m_resetFocus )
{ {
m_resetFocus = false; m_resetFocus = false;
wxWindow* tc = GetTextCtrl(); if ( GetTextCtrl() )
if ( tc ) GetTextCtrl()->SetFocus();
tc->SetFocus();
} }
} }