Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VC++ TreeView Control

  • 01-02-2002 5:04pm
    #1
    Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭


    I'm trying to add some nodes to a TreeView Control but I have absolutley no idea where to start.

    Anybody got any ideas ? MS VC++ 6.0 SP3

    Thanks for all the help with the last post


Comments

  • Closed Accounts Posts: 411 ✭✭Jay


    Tree Views are quite tedious to use in VC++.

    I have quite a lot of experience with them. Where to begin...
    First off, to add a TV to the window/dialog.

    You have to have called InitCommonControlsEx with ICC_TREEVIEW_CLASSES specified.

    To draw the window use CreateWindowEx with WC_TREEVIEW as the class name.

    To add nodes to the tree...
    Each node has a set of properties, stored in a TVITEM structure.

    Each node has parents, siblings and children.
    The control itself has one parent of all the children. This can be retrieved by calling
    HTREEITEM ParentItem = TreeView_GetRoot(hCtrl);

    You can then use TreeView_GetItem(hCtrl, &tvitem);
    to retrieve the properties of each node, including the parent node.

    Calls such as TreeView_InsertItem and TreeView_SetItem are used to insert new items and set the properties of existing nodes.

    You can traverse through the tree view by using calls such as TreeView_GetNextSibling, TreeView_GetPrevSibling, TreeView_GetParent, TreeView_GetChild.

    I think that should be enough to get you started.

    If you have any more questions, just stick them up here.


Advertisement