WX_DEFINE_LIST( wxNotebookPageInfoList )
BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
- EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
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);
}
}
m_selection++;
}
- // some page should be selected: either this one or the first one if there
- // is still no selection
- int selNew = wxNOT_FOUND;
- if ( bSelect )
- selNew = nPage;
- else if ( m_selection == wxNOT_FOUND )
- selNew = 0;
-
- if ( selNew != wxNOT_FOUND )
- SetSelection(selNew);
+ DoSetSelectionAfterInsertion(nPage, bSelect);
InvalidateBestSize();
event.Skip();
}
-void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
-{
- // is it our tab control?
- if ( event.GetEventObject() == this )
- {
- UpdateSelection(event.GetSelection());
- }
-
- // we want to give others a chance to process this message as well
- event.Skip();
-}
-
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
if ( event.IsWindowChange() ) {
event.SetInt(idCtrl);
bool processed = HandleWindowEvent(event);
+ if ( hdr->code == TCN_SELCHANGE )
+ UpdateSelection(event.GetSelection());
+
*result = !event.IsAllowed();
return processed;
}