]> git.saurik.com Git - wxWidgets.git/commitdiff
To avoid error message, do not even try to set focus on MSW popup window that doesn...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 25 Nov 2008 17:04:48 +0000 (17:04 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 25 Nov 2008 17:04:48 +0000 (17:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/popupcmn.cpp

index 1e789810b197ea320ee5d5509238abe5b158fc33..98eb20b8736405c5c2f8c2f81a47f82106ce7e2a 100644 (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