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
This commit is contained in:
Vadim Zeitlin
2008-04-06 15:37:52 +00:00
parent 3fedffdc05
commit 7e45c15989

View File

@@ -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);