diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 3e17c1ae5e..440cbcf32e 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -578,7 +578,9 @@ void WidgetsFrame::InitBook() // but ensure that the top of the tree is shown nevertheless wxTreeCtrl * const tree = m_book->GetTreeCtrl(); - tree->EnsureVisible(tree->GetRootItem()); + + wxTreeItemIdValue cookie; + tree->EnsureVisible(tree->GetFirstChild(tree->GetRootItem(), cookie)); #endif // USE_TREEBOOK }