Update the currently selected page before generating
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED event in wxMSW wxNotebook. This is more
consistent with other ports and more logical as "-ED" events are supposed to
be sent after the action they notify about is completed. And it also allows to
set the focus in this event handler whereas any attempts to do it would have
been disregarded before as changing the active page resets focus.
Notice that this does introduce an incompatibility: calling
wxNotebook::GetSelection() from PAGE_CHANGED event handler now returns the new
page and not the old one as before. Again, this is more logical and more
consistent.
Closes #12688.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66224
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
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
-----------------------------------------------------------
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);
}
}