To avoid error message, do not even try to set focus on MSW popup window that doesn't have WS_POPUP style (closes #10157)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli 2008-11-25 17:04:48 +00:00
parent 36b6a92876
commit 582699e1ac

View File

@ -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