From 26f0e816ca8bd613fbd0c1650e91b7fc47226960 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Thu, 1 Nov 2018 10:07:42 -0400 Subject: [PATCH] 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 --- docs/changes.txt | 2 ++ src/aui/auibook.cpp | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 2b3971365f..25d36877e0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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 ----------------------------------------------------- diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index ae8ae603d0..f1298c9997 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -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; } }