LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the child to go under the appropriate parent based on the name?

Solved!
Go to solution

I am trying to read in a .ini file and based on the Group Name, I want the child to go under that name. If I read in another file and it has the same group name I want the child to go under that name. Right now I can't even get the child to go under a different group name when it is supposed to. It keeps going under the same Parent name. Here is my code.

 

int relative = 0; 

 

Ini_GetStringIntoBuffer (iniText, "Details","Group", cbuf, BUFSIZE);

InsertTreeItem(s_gMainWindow.managerTab, MANAGERTAB_TREE, VAL_SIBLING, 0,
      VAL_NEXT, cbuf, NULL, 0, relative);

Ini_GetStringIntoBuffer (iniText, "Details","Name", cbuf, BUFSIZE);
     
 InsertTreeItem(s_gMainWindow.managerTab, MANAGERTAB_TREE, VAL_CHILD, 0,
      VAL_LAST, cbuf, NULL, 0, relative++);
     

Ini_GetStringIntoBuffer (iniText, "Details","Version", cbuf, BUFSIZE);
     
     SetTreeCellAttribute (s_gMainWindow.managerTab, MANAGERTAB_TREE, relate, 1, ATTR_LABEL_TEXT, cbuf); //I can't get this to match up with the child column.

 

 

Message Edited by InquiringMind on 03-10-2009 08:14 AM
0 Kudos
Message 1 of 2
(2,932 Views)
Solution
Accepted by topic author InquiringMind

you may try this:

 

int relative = 0; 

int parent, index;

 

Ini_GetStringIntoBuffer (iniText, "Details","Group", cbuf, BUFSIZE);

parent = InsertTreeItem(s_gMainWindow.managerTab, MANAGERTAB_TREE, VAL_SIBLING, 0,
      VAL_NEXT, cbuf, NULL, 0, relative);

Ini_GetStringIntoBuffer (iniText, "Details","Name", cbuf, BUFSIZE);
index = InsertTreeItem(s_gMainWindow.managerTab, MANAGERTAB_TREE, VAL_CHILD, parent,
      VAL_LAST, cbuf, NULL, 0, relative++);
     

Ini_GetStringIntoBuffer (iniText, "Details","Version", cbuf, BUFSIZE);
SetTreeCellAttribute (s_gMainWindow.managerTab, MANAGERTAB_TREE, index, 1, ATTR_LABEL_TEXT, cbuf);

 

the idea is to keep the index of the item you insert, in order to reuse it when you want to modify the item.

0 Kudos
Message 2 of 2
(2,903 Views)