03-10-2009 08:06 AM - edited 03-10-2009 08:14 AM
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.
Solved! Go to Solution.
03-11-2009 04:53 AM
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.