several notebook bugs fixed:

1. deleting the last page sets selection to -1
2. deleting the selected page unselects it first
3. adding page calls Layout() on it


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-24 21:27:52 +00:00
parent b1cf23dc26
commit 96d3780753
3 changed files with 42 additions and 4 deletions

View File

@@ -274,11 +274,22 @@ bool wxNotebook::DeletePage(int nPage)
{
wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") );
if ( m_nSelection == nPage ) {
// advance selection backwards - the page being deleted shouldn't be left
// selected
AdvanceSelection(FALSE);
}
TabCtrl_DeleteItem(m_hwnd, nPage);
delete m_aPages[nPage];
m_aPages.Remove(nPage);
if ( m_aPages.IsEmpty() ) {
// no selection if the notebook became empty
m_nSelection = -1;
}
return TRUE;
}
@@ -370,6 +381,11 @@ bool wxNotebook::InsertPage(int nPage,
// this updates internal flag too - otherwise it will get out of sync
pPage->Show(FALSE);
// FIXME this is ugly, I'm breaking my own rules... but needed to get display
// right (why?)
wxSizeEvent event;
OnSize(event);
return TRUE;
}