From: Vadim Zeitlin Date: Sun, 9 Dec 2001 14:35:54 +0000 (+0000) Subject: ItemHasChildren() should return TRUE for the items which have plus button as they... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/59a2e6354dec7c250dd40e86bb79c259bfecca36 ItemHasChildren() should return TRUE for the items which have plus button as they could have children even if they currently don't git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 2ded3f6413..ad9602c0b8 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -881,7 +881,12 @@ bool wxGenericTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") ); - return !((wxGenericTreeItem*) item.m_pItem)->GetChildren().IsEmpty(); + // consider that the item does have children if it has the "+" button: it + // might not have them (if it had never been expanded yet) but then it + // could have them as well and it's better to err on this side rather than + // disabling some operations which are restricted to the items with + // children for an item which does have them + return !((wxGenericTreeItem*) item.m_pItem)->HasPlus(); } bool wxGenericTreeCtrl::IsExpanded(const wxTreeItemId& item) const