a better fix for notebook page not being refreshed after Delete()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
dba860d9e4
commit
43a997b6e2
@ -320,16 +320,36 @@ wxNotebookPage *wxNotebook::DoRemovePage(int nPage)
|
||||
}
|
||||
else // notebook still not empty
|
||||
{
|
||||
// refresh the selected page and change it if it became invalid
|
||||
// change the selected page if it was deleted or became invalid
|
||||
int selNew;
|
||||
if ( m_nSelection == GetPageCount() )
|
||||
{
|
||||
m_nSelection--;
|
||||
// last page deleted, make the new last page the new selection
|
||||
selNew = m_nSelection - 1;
|
||||
}
|
||||
else if ( nPage <= m_nSelection )
|
||||
{
|
||||
// we must show another page, even if it has the same index
|
||||
selNew = m_nSelection;
|
||||
}
|
||||
else // nothing changes for the currently selected page
|
||||
{
|
||||
selNew = -1;
|
||||
|
||||
// we still must refresh the current page: this needs to be done
|
||||
// for some unknown reason if the tab control shows the up-down
|
||||
// control (i.e. when there are too many pages) -- otherwise after
|
||||
// deleting a page nothing at all is shown
|
||||
m_pages[m_nSelection]->Refresh();
|
||||
}
|
||||
|
||||
// force ChangePage() to really do something
|
||||
int sel = m_nSelection;
|
||||
m_nSelection = -1;
|
||||
SetSelection(sel);
|
||||
if ( selNew != -1 )
|
||||
{
|
||||
// m_nSelection must be always valid so reset it before calling
|
||||
// SetSelection()
|
||||
m_nSelection = -1;
|
||||
SetSelection(selNew);
|
||||
}
|
||||
}
|
||||
|
||||
return pageRemoved;
|
||||
|
Loading…
Reference in New Issue
Block a user