Get next item in outline
Posted
by Zafir Anjum
on August 6th, 1998
HTREEITEM GetNextItem( HTREEITEM hItem, UINT nCode ){
return CTreeCtrl::GetNextItem( hItem, nCode );
}
HTREEITEM GetNextItem( HTREEITEM hItem);
It is important that we override the original function taking two arguments
otherwise our new version of the function will hide it. Now here is the
listing of the overloaded GetNextItem() function.
// GetNextItem - Get next item as if outline was completely expanded
// Returns - The item immediately below the reference item
// hItem - The reference item
HTREEITEM CTreeCtrlX::GetNextItem( HTREEITEM hItem )
{
HTREEITEM hti;
if( ItemHasChildren( hItem ) )
return GetChildItem( hItem ); // return first child
else{
// return next sibling item
// Go up the tree to find a parent's sibling if needed.
while( (hti = GetNextSiblingItem( hItem )) == NULL ){
if( (hItem = GetParentItem( hItem ) ) == NULL )
return NULL;
}
}
return hti;
}

Comments
Thanks
Posted by Legacy on 07/05/2003 12:00amOriginally posted by: Gopobandhu
your code is very help to me.
Thanks for it.
Replyimproved version
Posted by Legacy on 03/15/1999 12:00amOriginally posted by: Jim Dill
Reply