LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem encountered in inserting tree items

Solved!
Go to solution

Hello All.

 

I am encountering problem in inserting tree items in a parent child recurring manner. My requirement is that everytime i presses the button, one parent should be inserted in the tree along with its child. Its output should be just like

Fault Code: 7400

Fault Code: 7400

Fault Code: 7401

Fault Code: 7401

and so on.

I am not getting the desired output. What should be way of doing this. Please find the attached project too.

 

Regards.

0 Kudos
Message 1 of 3
(2,954 Views)
Solution
Accepted by topic author Moshi

I have no CVI on this machine to run your project, but in a fast look at the code I noticed that you are always using 0 as the item index. You mustr save the index of the parent item and use it for the childs instead:

 

  idx = InsertTreeItem (panelHandle, PANEL_TREE, VAL_SIBLING, 0,     VAL_LAST,temp_buffer, "",0, -1);
  InsertTreeItem (panelHandle, PANEL_TREE, VAL_CHILD, idx,         VAL_LAST,temp_buffer, "",0, -1);

but I don't understand what the child means: the code above will produce the following output ( + here mimics the tree symbols):

Fault code: 7400

 + Fault code: 7400

Fault code: 7401

 + Fault code: 7401



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(2,952 Views)

Thanks..I got the after you have pointed the mistake in relative index.I have just corrected the relative index and got the desired output 🙂

0 Kudos
Message 3 of 3
(2,935 Views)