diff --git a/docs/changes.txt b/docs/changes.txt index d125bb1f5d..dac31aa9f4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -169,6 +169,12 @@ Changes in behaviour not resulting in compilation errors, please read this! regardless of whether the flag was specified or not. This only affects legacy ANSI builds. +- wxNotebook::GetSelection() returns the new page index when called from + wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED event handler in wxMSW, not the old one. + The new behaviour is consistent with wxGTK and more logical but different + from the previous versions. Using wxNotebookEvent::GetSelection() instead of + querying the notebook selection avoids the problem and is recommended. + Changes in behaviour which may result in compilation errors ----------------------------------------------------------- diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 05a1136e4a..4b3c6e0aee 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -454,11 +454,13 @@ int wxNotebook::SetSelection(size_t nPage) if ( SendPageChangingEvent(nPage) ) { // program allows the page change - SendPageChangedEvent(m_selection, nPage); + const int selectionOld = m_selection; UpdateSelection(nPage); TabCtrl_SetCurSel(GetHwnd(), nPage); + + SendPageChangedEvent(selectionOld, nPage); } }