Selection should be set to -1 if all pages are deleted, or the next
insertion will try to set the selection to 1. Fixed lack of initial controller resize when first page is added, though I think the listctrl should probably always have a decent initial height even when empty. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
52f15cb7bb
commit
6a82a0d041
@ -301,7 +301,14 @@ wxListbook::InsertPage(size_t n,
|
||||
SetSelection(selNew);
|
||||
|
||||
InvalidateBestSize();
|
||||
// GetListView()->InvalidateBestSize();
|
||||
GetListView()->Arrange();
|
||||
|
||||
if (GetPageCount() == 1)
|
||||
{
|
||||
wxSizeEvent sz(GetSize(), GetId());
|
||||
ProcessEvent(sz);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -331,6 +338,11 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
||||
}
|
||||
|
||||
GetListView()->Arrange();
|
||||
if (GetPageCount() == 0)
|
||||
{
|
||||
wxSizeEvent sz(GetSize(), GetId());
|
||||
ProcessEvent(sz);
|
||||
}
|
||||
}
|
||||
|
||||
return win;
|
||||
@ -340,7 +352,15 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
||||
bool wxListbook::DeleteAllPages()
|
||||
{
|
||||
GetListView()->DeleteAllItems();
|
||||
return wxBookCtrlBase::DeleteAllPages();
|
||||
if (!wxBookCtrlBase::DeleteAllPages())
|
||||
return false;
|
||||
|
||||
m_selection = -1;
|
||||
|
||||
wxSizeEvent sz(GetSize(), GetId());
|
||||
ProcessEvent(sz);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user