From c4691daac745235f89ff92558c81f783d5a23569 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 16 Jul 2014 22:55:11 +0000 Subject: [PATCH] Don't consider hidden root item to be visible in wxGenericTreeCtrl. This fixes wrong results returned by GetFirstVisibleItem() in the tree control with wxTR_HIDE_ROOT style. Closes #4482. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index c0da824eaf..704d2e0a07 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1315,6 +1315,10 @@ bool wxGenericTreeCtrl::IsVisible(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); + // Hidden root item is never visible. + if ( item == GetRootItem() && HasFlag(wxTR_HIDE_ROOT) ) + return false; + // An item is only visible if it's not a descendant of a collapsed item wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; wxGenericTreeItem* parent = pItem->GetParent();