]> git.saurik.com Git - wxWidgets.git/commitdiff
don't set focus to a hidden notebook (patch 1299005)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Sep 2005 21:22:28 +0000 (21:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Sep 2005 21:22:28 +0000 (21:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/notebook.cpp

index 99f9d4ed8fd05205bd3560f5ee48fade2aaf72d2..60d674450b974f97ba7964c3b2b9073502c0f849 100644 (file)
@@ -8,6 +8,7 @@ wxWidgets Change Log - For more verbose changes, see the manual
 wxMSW:
 
 - wxFileDialog respects absence of wxCHANGE_DIR flag under NT (Brad Anderson)
 wxMSW:
 
 - wxFileDialog respects absence of wxCHANGE_DIR flag under NT (Brad Anderson)
+- Switching page of a hidden notebook doesn't lose focus (Jamie Gadd)
 
 Unix:
 
 
 Unix:
 
index f6d53a75f480631683c2ed5b2b49ea4fd6914578..5e303cf3dd8ed06dd70cb5779122d32c677c6ce6 100644 (file)
@@ -90,7 +90,7 @@
 static WXFARPROC gs_wndprocNotebookSpinBtn = (WXFARPROC)NULL;
 
 // the pointer to standard tab control wnd proc
 static WXFARPROC gs_wndprocNotebookSpinBtn = (WXFARPROC)NULL;
 
 // the pointer to standard tab control wnd proc
-static WXFARPROC gs_wndprocNotebook = (WXFARPROC)NULL; 
+static WXFARPROC gs_wndprocNotebook = (WXFARPROC)NULL;
 
 LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
                                            UINT message,
 
 LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
                                            UINT message,
@@ -812,8 +812,6 @@ LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
                             hwnd, message, wParam, lParam);
 }
 
                             hwnd, message, wParam, lParam);
 }
 
-
 void wxNotebook::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
 {
     // do nothing here
 void wxNotebook::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
 {
     // do nothing here
@@ -991,20 +989,17 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event)
       {
         wxNotebookPage *pPage = m_pages[sel];
         pPage->Show(true);
       {
         wxNotebookPage *pPage = m_pages[sel];
         pPage->Show(true);
+      }
 
 
-        // As per bug report:
-        // http://sourceforge.net/tracker/index.php?func=detail&aid=1150659&group_id=9863&atid=109863,
-        // we should not set the page focus (and thereby the focus for
-        // a child window) since it erroneously selects radio button controls and also
-        // breaks keyboard handling for a notebook's scroll buttons. So
-        // we always focus the notebook and not the page.
-        SetFocus();
+      // Changing the page should give the focus to it but, as per bug report
+      // http://sf.net/tracker/index.php?func=detail&aid=1150659&group_id=9863&atid=109863,
+      // we should not set the focus to it directly since it erroneously
+      // selects radio buttons and breaks keyboard handling for a notebook's
+      // scroll buttons. So give focus to the notebook and not the page.
 
 
-      }
-      else // no pages in the notebook, give the focus to itself
-      {
-          SetFocus();
-      }
+      // but don't do this is the notebook is hidden
+      if ( ::IsWindowVisible(GetHwnd()) )
+        SetFocus();
 
       m_nSelection = sel;
   }
 
       m_nSelection = sel;
   }