Change wxNotebook selection before sending page changed event in wxMSW.
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED handler should see the new page selected in the control, not the old one as was the case if the page was changed using the mouse in wxMSW. This should have been done together with the other changes of r66224, see its commit message for more details. Closes 13145. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e71508e160
commit
c7e94140cd
@ -972,6 +972,12 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
nameControl,
|
||||
veto;
|
||||
const wxEventType eventType = event.GetEventType();
|
||||
|
||||
// NB: can't use wxStaticCast here as wxBookCtrlBase is not in
|
||||
// wxRTTI
|
||||
const wxBookCtrlBase * const
|
||||
book = static_cast<wxBookCtrlBase *>(event.GetEventObject());
|
||||
|
||||
for ( size_t n = 0; n < WXSIZEOF(events); n++ )
|
||||
{
|
||||
const EventInfo& ei = events[n];
|
||||
@ -983,10 +989,6 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
{
|
||||
const int idx = event.GetOldSelection();
|
||||
|
||||
// NB: can't use wxStaticCast here as wxBookCtrlBase is not in
|
||||
// wxRTTI
|
||||
const wxBookCtrlBase * const
|
||||
book = static_cast<wxBookCtrlBase *>(event.GetEventObject());
|
||||
if ( idx != wxNOT_FOUND &&
|
||||
book && book->GetPageText(idx) == VETO_PAGE_NAME )
|
||||
{
|
||||
@ -1017,13 +1019,14 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
|
||||
static int s_num = 0;
|
||||
|
||||
wxLogMessage(wxT("Event #%d: %s: %s (%d) new sel %d, old %d%s"),
|
||||
wxLogMessage(wxT("Event #%d: %s: %s (%d) new sel %d, old %d, current %d%s"),
|
||||
++s_num,
|
||||
nameControl.c_str(),
|
||||
nameEvent.c_str(),
|
||||
eventType,
|
||||
event.GetSelection(),
|
||||
event.GetOldSelection(),
|
||||
book->GetSelection(),
|
||||
veto.c_str());
|
||||
|
||||
#if USE_LOG
|
||||
|
@ -1314,10 +1314,12 @@ bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
|
||||
event.SetEventObject(this);
|
||||
event.SetInt(idCtrl);
|
||||
|
||||
bool processed = HandleWindowEvent(event);
|
||||
// Change the selection before generating the event as its handler should
|
||||
// already see the new page selected.
|
||||
if ( hdr->code == TCN_SELCHANGE )
|
||||
UpdateSelection(event.GetSelection());
|
||||
|
||||
bool processed = HandleWindowEvent(event);
|
||||
*result = !event.IsAllowed();
|
||||
return processed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user