diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 1e789810b1..98eb20b873 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -260,8 +260,16 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus) m_child->PushEventHandler(m_handlerPopup); - m_focus = winFocus ? winFocus : this; - m_focus->SetFocus(); +#if defined(__WXMSW__) + // Focusing on child of popup window does not work on MSW unless WS_POPUP + // style is set. We do not even want to try to set the focus, as it may + // provoke errors on some Windows versions (Vista and later). + if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & WS_POPUP ) +#endif + { + m_focus = winFocus ? winFocus : this; + m_focus->SetFocus(); + } #if defined( __WXMSW__ ) || defined( __WXMAC__) // MSW doesn't allow to set focus to the popup window, but we need to