Focus event recursion fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1581,8 +1581,9 @@ void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event )
|
|||||||
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
||||||
{
|
{
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
if ( m_text && m_text != ::wxWindow::FindFocus() )
|
wxWindow* tc = GetTextCtrl();
|
||||||
m_text->SetFocus();
|
if ( tc && tc != DoFindFocus() )
|
||||||
|
tc->SetFocus();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1777,6 +1778,8 @@ void wxComboCtrlBase::ShowPopup()
|
|||||||
popup = m_popup;
|
popup = m_popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
winPopup->Enable();
|
||||||
|
|
||||||
wxASSERT( !m_popup || m_popup == popup ); // Consistency check.
|
wxASSERT( !m_popup || m_popup == popup ); // Consistency check.
|
||||||
|
|
||||||
wxSize adjustedSize = m_popupInterface->GetAdjustedSize(widthPopup,
|
wxSize adjustedSize = m_popupInterface->GetAdjustedSize(widthPopup,
|
||||||
@@ -1923,20 +1926,13 @@ void wxComboCtrlBase::OnPopupDismiss()
|
|||||||
if ( IsPopupWindowState(Hidden) )
|
if ( IsPopupWindowState(Hidden) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// NB: Focus setting is really funny, atleast on wxMSW. First of all,
|
// This must be set before focus - otherwise there will be recursive
|
||||||
// we need to have SetFocus at the end. Otherwise wxTextCtrl may
|
// OnPopupDismisses.
|
||||||
// freeze until focus goes somewhere else. Second, wxTreeCtrl as
|
|
||||||
// popup, when dismissing, "steals" focus back to itself unless
|
|
||||||
// SetFocus is called also here, exactly before m_popupWinState
|
|
||||||
// is set to false. Which is truly weird since SetFocus is just
|
|
||||||
// wxWindowMSW method and does not call event handler or anything like
|
|
||||||
// that (ie. does not care about m_popupWinState).
|
|
||||||
|
|
||||||
SetFocus();
|
|
||||||
|
|
||||||
// This should preferably be set before focus.
|
|
||||||
m_popupWinState = Hidden;
|
m_popupWinState = Hidden;
|
||||||
|
|
||||||
|
//SetFocus();
|
||||||
|
m_winPopup->Disable();
|
||||||
|
|
||||||
// Inform popup control itself
|
// Inform popup control itself
|
||||||
m_popupInterface->OnDismiss();
|
m_popupInterface->OnDismiss();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user