#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Posts
    0
    Rep Power
    0

    Unhappy Recursive function pls help


    Hi Ive got a treeview control and I want to go through every node on the tree to locate an item.

    Can any1 give me the basic gist of the recursive function I need to write pls?
    I need to be able to go through every node and when I find the item in the leaf node I want to be able to jump back to its parent and move onto the next parent node.

    THANKS!!!

    I have the following so far

    TVITEM NodeStruct = {0};
    HTREEITEM hTreeItem = NULL;

    int NodeType = 0; // The current type of node selected
    int Position = 0; // if present the command position. Needed to find exact command

    // Get the currently selected nodes information
    hTreeItem = TreeView_GetRoot(hTreeView); // Get the handle of the currently
    NodeStruct.hItem = hTreeItem; // Retrieve information regarding this item
    NodeStruct.mask = TVIF_TEXT | TVIF_PARAM; // The text and lParam attributes are valid
    NodeStruct.pszText = Name; // Pointer to the variable to hold the retrieved name
    NodeStruct.cchTextMax = MAX_NAME;

    SendDlgItemMessage(hWnd, IDC_SR_TREE, TVM_GETITEM, 0, (LPARAM) (LPTVITEMEX) &NodeStruct); // Get the info

    // perform some checking on this node and repeat.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    Detroit, MI
    Posts
    14
    Rep Power
    0

    It's been a while but...


    It's been a few years since I had classes designing tree structures (I tried to design an AVL balanced binary tree with threads but failed), but since no one else has posted I can give it a whack with more information.

    Is it a b-tree, a binary tree, or something else?
    And is it threaded, balanced, both, or neither?

    -Carl
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Posts
    0
    Rep Power
    0
    Its simply a constructed treeview with items added.

    The item level can be either


    ROOT_NODE
    GROUP_NODE
    MACRO_NODE
    COMMAND_NODE

    it should be pretty straight forward but i cant grasp it

IMN logo majestic logo threadwatch logo seochat tools logo