]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dialog.cpp
Added some makefiles for caret, scroll and drawing samples.
[wxWidgets.git] / src / msw / dialog.cpp
index ec79f72f57f21f3197ea457afbc59a475532c5f6..d1979b9a4e3639b27b3df6a6ffd326176ba6df9b 100644 (file)
@@ -310,7 +310,13 @@ bool wxDialog::Show(bool show)
   {
     if (show)
     {
-      m_hwndOldFocus = (WXHWND)::GetFocus();
+      // find the top level window which had focus before - we will restore
+      // focus to it later
+      m_hwndOldFocus = 0;
+      for ( HWND hwnd = ::GetFocus(); hwnd; hwnd = ::GetParent(hwnd) )
+      {
+        m_hwndOldFocus = (WXHWND)hwnd;
+      }
 
       if (m_modalShowing)
       {