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:
@@ -301,7 +301,14 @@ wxListbook::InsertPage(size_t n,
|
|||||||
SetSelection(selNew);
|
SetSelection(selNew);
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
// GetListView()->InvalidateBestSize();
|
||||||
GetListView()->Arrange();
|
GetListView()->Arrange();
|
||||||
|
|
||||||
|
if (GetPageCount() == 1)
|
||||||
|
{
|
||||||
|
wxSizeEvent sz(GetSize(), GetId());
|
||||||
|
ProcessEvent(sz);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,6 +338,11 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetListView()->Arrange();
|
GetListView()->Arrange();
|
||||||
|
if (GetPageCount() == 0)
|
||||||
|
{
|
||||||
|
wxSizeEvent sz(GetSize(), GetId());
|
||||||
|
ProcessEvent(sz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
@@ -340,7 +352,15 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
|||||||
bool wxListbook::DeleteAllPages()
|
bool wxListbook::DeleteAllPages()
|
||||||
{
|
{
|
||||||
GetListView()->DeleteAllItems();
|
GetListView()->DeleteAllItems();
|
||||||
return wxBookCtrlBase::DeleteAllPages();
|
if (!wxBookCtrlBase::DeleteAllPages())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_selection = -1;
|
||||||
|
|
||||||
|
wxSizeEvent sz(GetSize(), GetId());
|
||||||
|
ProcessEvent(sz);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user