Mike C Posted April 29, 2004 Report Share Posted April 29, 2004 Hello, I am trying to generate a tree from a table of data. For some reason I cannot figure out how to get the parents to show correctly. I am attaching the image below illustrating my problem. The first column is suppsed to be the parent and the second column is supposed to be the child. Does anybody have any suggestions on how to correct this? Thanks Quote Link to comment
Michael Aivaliotis Posted April 30, 2004 Report Share Posted April 30, 2004 Actually LabVIEW is doing exactly what you are telling it to do. LabVIEW does not care what order you create things in. You can build the tree out of sequence. The only thing that matters is the parent tag. In your case you are telling all the childs to attach themselves to a parent that has a tag with the label "a". If you look at the LV help you will read this: Child Tag: A unique tag for the new item. The default is the string you wire to Left Cell. If an existing tag already uses that string, LabVIEW appends a number to the string to create a unique tag for the new item. So this means that the new parents will have the following tags: a a_1 a_2 You can see this after you run your VI. If you right-click on the tree control and select Edit Items... You will see tag a_1 etc. So, the key is to attach the child to the correct parent tag. How do you do this? Well LV provides the tag value that was generated for the parent tag. You can use this value for the reference to the child. I've shown you how to do this in the attached image. Quote Link to comment
Mike C Posted April 30, 2004 Author Report Share Posted April 30, 2004 Thanks Michael. Unfortunately that's not what I am trying to accomplish. I probably did not explain it very well. In my example I am actually trying to set a as the parent for 1, 2 and 3. I accomplish that but I get two additional a parents (actually is No of children -1 additional parents). i.e. _a |_1 |_2 |_3 Quote Link to comment
PJM_labview Posted April 30, 2004 Report Share Posted April 30, 2004 Hi Mike It seem that you need to initialize the parent first (outside the loop). By doing so I got the following: a |_3 |_2 |_1 Cheers PJM Quote Link to comment
Mike C Posted April 30, 2004 Author Report Share Posted April 30, 2004 Thank you. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.