Send wxEVT_AUINOTEBOOK_PAGE_CHANGED after changing the page

For consistency with the other similar events and because it is more
useful for the code handling it, send this event when the new page is
already shown instead of doing it before showing it.

Closes https://github.com/wxWidgets/wxWidgets/pull/1007
This commit is contained in:
Daniel Kulp 2018-11-01 10:07:42 -04:00 committed by Vadim Zeitlin
parent 65827a0572
commit 26f0e816ca
2 changed files with 9 additions and 8 deletions

View File

@ -51,6 +51,8 @@ Changes in behaviour not resulting in compilation errors
consistency with the other ports. You now need to call SetMargins(0, 0)
explicitly if you really don't want to have any margins in your buttons.
- wxEVT_AUINOTEBOOK_PAGE_CHANGED event is now sent after changing the page,
as expected, and not before doing it.
Changes in behaviour which may result in build errors
-----------------------------------------------------

View File

@ -3423,14 +3423,6 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events)
int old_curpage = m_curPage;
m_curPage = n;
// program allows the page change
if(events)
{
evt.SetEventType(wxEVT_AUINOTEBOOK_PAGE_CHANGED);
(void)GetEventHandler()->ProcessEvent(evt);
}
wxAuiTabCtrl* ctrl;
int ctrl_idx;
if (FindTab(wnd, &ctrl, &ctrl_idx))
@ -3464,6 +3456,13 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events)
if (wnd->IsShownOnScreen() && FindFocus() != ctrl)
wnd->SetFocus();
// program allows the page change
if(events)
{
evt.SetEventType(wxEVT_AUINOTEBOOK_PAGE_CHANGED);
(void)GetEventHandler()->ProcessEvent(evt);
}
return old_curpage;
}
}