Send page changed event after changing the page in wxMSW wxNotebook.
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user