From 7e45c1598999ada6caad3a9c3e051d50a14e2cc1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 6 Apr 2008 15:37:52 +0000 Subject: [PATCH] refresh the item after adding its first child as, apparently, otherwise the '+' is not always drawn immediately (patch 1927179) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/treectrl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index cbda527b0e..4a8d830be2 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -1531,12 +1531,24 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent, tvIns.item.lParam = (LPARAM)param; tvIns.item.mask = mask; + const bool firstChild = !TreeView_GetChild(GetHwnd(), HITEM(parent)); + HTREEITEM id = TreeView_InsertItem(GetHwnd(), &tvIns); if ( id == 0 ) { wxLogLastError(wxT("TreeView_InsertItem")); } + // apparently some Windows versions (2000 and XP are reported to do this) + // sometimes don't refresh the tree after adding the first child and so we + // need this to make the "[+]" appear + if ( firstChild ) + { + RECT rect; + TreeView_GetItemRect(GetHwnd(), HITEM(parent), &rect, FALSE); + ::InvalidateRect(GetHwnd(), &rect, FALSE); + } + // associate the application tree item with Win32 tree item handle param->SetItem(id); -- 2.45.2