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

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56969 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-11-25 17:14:32 +00:00
parent 50aa31b878
commit dac1482189

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