From: Vadim Zeitlin Date: Sat, 24 Sep 2005 21:22:28 +0000 (+0000) Subject: don't set focus to a hidden notebook (patch 1299005) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e1cffcd6e37ef0c3e35cc02a67cbf8c6e18f588f don't set focus to a hidden notebook (patch 1299005) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 99f9d4ed8f..60d674450b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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) +- Switching page of a hidden notebook doesn't lose focus (Jamie Gadd) Unix: diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index f6d53a75f4..5e303cf3dd 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -90,7 +90,7 @@ 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, @@ -812,8 +812,6 @@ LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd, hwnd, message, wParam, lParam); } - - 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); + } - // 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; }