From: Vadim Zeitlin Date: Sun, 7 Nov 2010 19:33:10 +0000 (+0000) Subject: Don't require skipping "page changed" event in wxMSW wxNotebook. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/409f747ed9f08095e81aea317e1ed19410a1664d Don't require skipping "page changed" event in wxMSW wxNotebook. wxMSW wxNotebook implementation used to handle EVT_NOTEBOOK_PAGE_CHANGED event to update the currently shown page which meant that page changing was broken if the user code handled and didn't skip this event. As the other ports don't require the user code to skip this event, don't do this in wxMSW neither and always update the selected page unconditionally. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index f925deeed7..d8bbb995c1 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -148,7 +148,6 @@ public: // callbacks // --------- void OnSize(wxSizeEvent& event); - void OnSelChange(wxBookCtrlEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); // base class virtuals diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 046096b05f..05a1136e4a 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -122,7 +122,6 @@ static bool HasTroubleWithNonTopTabs() WX_DEFINE_LIST( wxNotebookPageInfoList ) BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) - EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange) EVT_SIZE(wxNotebook::OnSize) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) @@ -457,6 +456,8 @@ int wxNotebook::SetSelection(size_t nPage) // program allows the page change SendPageChangedEvent(m_selection, nPage); + UpdateSelection(nPage); + TabCtrl_SetCurSel(GetHwnd(), nPage); } } @@ -1082,18 +1083,6 @@ void wxNotebook::OnSize(wxSizeEvent& event) event.Skip(); } -void wxNotebook::OnSelChange(wxBookCtrlEvent& event) -{ - // is it our tab control? - if ( event.GetEventObject() == this ) - { - UpdateSelection(event.GetSelection()); - } - - // we want to give others a chance to process this message as well - event.Skip(); -} - void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) { if ( event.IsWindowChange() ) { @@ -1446,6 +1435,9 @@ bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result) event.SetInt(idCtrl); bool processed = HandleWindowEvent(event); + if ( hdr->code == TCN_SELCHANGE ) + UpdateSelection(event.GetSelection()); + *result = !event.IsAllowed(); return processed; }