C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 8th, 2002, 03:08 PM
RCPAnimal RCPAnimal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 0 RCPAnimal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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.

Reply With Quote
  #2  
Old May 10th, 2002, 09:37 AM
Nichademus Nichademus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Detroit, MI
Posts: 14 Nichademus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #3  
Old May 10th, 2002, 10:49 AM
RCPAnimal RCPAnimal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 0 RCPAnimal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Recursive function pls help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap