I need to "intercept" a page change and "redirect" it to another page (as example, it is changing to page 1 and i want it to land on page 9).
The Page Changing event seemed the right place to do it by using the event->SetSelection, but the wxBookCtrlBase::DoSetSelection ignores the values of the event other than "allowed", so i can't follow that route.
What should be the best way to do this?
EVT_NOTEBOOK_PAGE_CHANGING: can i change the new page?
Re: EVT_NOTEBOOK_PAGE_CHANGING: can i change the new page?
Mhm, this looks quite odd to me from the user view point.
Anyway, did you try in the page changing event handler just vetoing the change and then calling wxNotebook::ChangeSelection() with CallAfter()?
Anyway, did you try in the page changing event handler just vetoing the change and then calling wxNotebook::ChangeSelection() with CallAfter()?
Re: EVT_NOTEBOOK_PAGE_CHANGING: can i change the new page?
I'm a bit lost, as it seems i'm not able to write a CallAfter() call which compiles.
Code: Select all
CallAfter( [m_MainPages] { m_MainPages->SetSelection(9); } );
Code: Select all
CallAfter( m_MainPages->SetSelection(9) );
How should i write that call?
Re: EVT_NOTEBOOK_PAGE_CHANGING: can i change the new page?
It seems that m_MainPages is a member so capture this instead:
Code: Select all
CallAfter( [this] { m_MainPages->SetSelection(9); } );