Asiyah Younas
May 18th, 1999, 09:58 AM
I have created a SDI application with CTreeView as a base class but not getting how to proceed further to create and display a tree structure on its main window. Please if any one of you can tell me that how to proceed further. It will be very helpfull if you can tell me the code to implement it.
Thanks.
BrianOG
May 18th, 1999, 10:08 AM
When you launch your app, the tree should be there in the main window (You can use Spy to verify this).
Then when you want to do something use CTreeView::GetTreeCtrl() to get the CTreeCtrl that is encapsulated within the view. Then simply use as you would in a dlg or form view.
E.g.void CTreeView::OnEditAddItem()
{
CTreeCtrl &tree = GetTreeCtrl();
HTREEITEM hItemParent = tree.InsertItem("the first item");
HTREEITEM hItemChild = tree.InsertItem("the second item", hItemParent);
tree.InsertItem("the third item", hItemChild);
}
and so on