#if wxUSE_UXTHEME
m_hbrBackground = NULL;
#endif // wxUSE_UXTHEME
+
+#if USE_NOTEBOOK_ANTIFLICKER
+ m_hasSubclassedUpdown = false;
+#endif // USE_NOTEBOOK_ANTIFLICKER
}
// default for dynamic class
::GetClientRect(GetHwnd(), &rc);
// This check is to work around a bug in TabCtrl_AdjustRect which will
- // cause a crash on win2k, or on XP with themes disabled, if the
- // wxNB_MULTILINE style is used and the rectangle is very small, (such as
- // when the notebook is first created.) The value of 20 is just
- // arbitrarily chosen, if there is a better way to determine this value
- // then please do so. --RD
- if ( !HasFlag(wxNB_MULTILINE) || (rc.right > 20 && rc.bottom > 20) )
+ // cause a crash on win2k or on XP with themes disabled if either
+ // wxNB_MULTILINE is used or tabs are placed on a side, if the rectangle
+ // is too small.
+ //
+ // The value of 20 is chosen arbitrarily but seems to work
+ if ( rc.right > 20 && rc.bottom > 20 )
{
TabCtrl_AdjustRect(GetHwnd(), false, &rc);
#if USE_NOTEBOOK_ANTIFLICKER
// subclass the spin control used by the notebook to scroll pages to
// prevent it from flickering on resize
- if ( !gs_wndprocNotebookSpinBtn )
+ if ( !m_hasSubclassedUpdown )
{
// iterate over all child windows to find spin button
for ( HWND child = ::GetWindow(GetHwnd(), GW_CHILD);
if ( !childWindow )
{
// subclass the spin button to override WM_ERASEBKGND
- gs_wndprocNotebookSpinBtn = (WXFARPROC)wxGetWindowProc(child);
+ if ( !gs_wndprocNotebookSpinBtn )
+ gs_wndprocNotebookSpinBtn = (WXFARPROC)wxGetWindowProc(child);
wxSetWindowProc(child, wxNotebookSpinBtnWndProc);
+ m_hasSubclassedUpdown = true;
break;
}
}
{
wxNotebookPage *pPage = m_pages[sel];
pPage->Show(true);
- pPage->SetFocus();
-
- // If the newly focused window is not a child of the new page,
- // SetFocus was not successful and the notebook itself should be
- // focused
- wxWindow *currentFocus = FindFocus();
- wxWindow *startFocus = currentFocus;
- while ( currentFocus && currentFocus != pPage && currentFocus != this )
- currentFocus = currentFocus->GetParent();
-
- if ( startFocus == pPage || currentFocus != pPage )
- SetFocus();
+
+ // 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();
}
else // no pages in the notebook, give the focus to itself