fix asserts when the root is hidden [backport of r45135 from trunk]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -327,6 +327,9 @@ void MyFrame::CreateTree(long style)
|
||||
m_treeCtrl = new MyTreeCtrl(m_panel, TreeTest_Ctrl,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
style);
|
||||
|
||||
GetMenuBar()->Enable(TreeTest_SelectRoot, !(style & wxTR_HIDE_ROOT));
|
||||
|
||||
Resize();
|
||||
}
|
||||
|
||||
@@ -519,6 +522,7 @@ void MyFrame::OnSelect(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnSelectRoot(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( !m_treeCtrl->HasFlag(wxTR_HIDE_ROOT) )
|
||||
m_treeCtrl->SelectItem(m_treeCtrl->GetRootItem());
|
||||
}
|
||||
|
||||
@@ -862,7 +866,7 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
||||
wxTreeItemId rootId = AddRoot(wxT("Root"),
|
||||
image, image,
|
||||
new MyTreeItemData(wxT("Root item")));
|
||||
if ( image != -1 )
|
||||
if ( !HasFlag(wxTR_HIDE_ROOT) && image != -1 )
|
||||
{
|
||||
SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
|
||||
}
|
||||
@@ -870,6 +874,7 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
||||
AddItemsRecursively(rootId, numChildren, depth, 0);
|
||||
|
||||
// set some colours/fonts for testing
|
||||
if ( !HasFlag(wxTR_HIDE_ROOT) )
|
||||
SetItemFont(rootId, *wxITALIC_FONT);
|
||||
|
||||
wxTreeItemIdValue cookie;
|
||||
|
Reference in New Issue
Block a user