In my CTreeCtrl, when I expand a node which is not visible the control automatically repositions the tree to make the expanded node visible. Is there any way to prevent this behaviour?
Use case: I have a tree which is loading items asynchronously from a remote source and may be building the 'bottom' of the tree for quite some time, and currently the tree behaviour of jumping to each node as it is completed is very distracting to the user.
Current workaround:
/******************************************************************************
Expand an item while retaining the tree position
******************************************************************************/
void CFileOpenTreeView::ExpandWithoutJumping(HTREEITEM hItem)
{
// This still flickers for some reason, but at least it doesn't jump
LockWindowUpdate();
HTREEITEM hFirstVisible = GetTreeCtrl().GetFirstVisibleItem();
GetTreeCtrl().Expand(hItem, TVE_EXPAND);
GetTreeCtrl().SelectSetFirstVisible(hFirstVisible);
UnlockWindowUpdate();
Invalidate();
}