From b9643cd619a0b01774669248eee908b2538c7dd7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 27 Nov 2006 16:35:06 +0000 Subject: [PATCH] cache the best size in overridden DoGetBestSize() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index c1cd97fdfb..4c9305f01e 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3651,9 +3651,15 @@ wxSize wxGenericTreeCtrl::DoGetBestSize() const { wxSize size = wxTreeCtrlBase::DoGetBestSize(); - // The generic control seems to have an implicit border + // there seems to be an implicit extra border around the items, although + // I'm not really sure where does it come from -- but without this, the + // scrollbars appear in a tree with default/best size size.IncBy(4, 4); + // avoid caching (necessarily arbitrary) default size for empty tree + if ( GetRootItem().IsOk() ) + CacheBestSize(size); + return size; } -- 2.47.2