01-12-2021 07:34 PM
Hello All,
I have been struggling for days trying to achieve this one task and I have decided to turn to the experts for help. I am a novice LabVIEW programmer so I need all the help I can get.
Basically I am trying to duplicate the contents of a selected tree with a new Parent String.
I did some research and found some information on the LabVIEW tree control but I did not have any luck trying to make it work for me.
If someone could point me in the right direction or even better give me an example, I would appreciate it.
Attached is a VI that I started and after numerous attempts I gave up.
PS. Is there a property node that provides the selected Tree Item + a way to tell if the selected Item is a Parent or a Child?
Thank You
Solved! Go to Solution.
01-12-2021 07:47 PM
Searching the forums, I found this thread. Copying data between tree controls
That might get you started.
01-12-2021 08:06 PM
This copies item between the Tree controls. I want to duplicate the selected Parent in the same tree.
For example: Select Parent 1 and click duplicate (Duplicates parent 1 and its child in the same tree, the Parent name would be different) I would pass the parent name through a SubVI dialog box.
01-12-2021 11:22 PM
I said it would get you started, not that it would exactly do what you want it to do.
You'd probably be using many of the same property and invoke nodes, but in a different arrangement.
01-15-2021 03:44 PM
Hello, I understand that this won't do exactly what i want. Is there a property node in Tree control that tells me the selected item, if the selected item is a parent or a child?
I guess this is where I am stuck.
Thank You
01-15-2021 06:53 PM
In the link I placed earlier, the VI there has the ActiveItemTag property node. It has an indent level property. If you look at all the tags, any item that has an indent level that is less than the indent level for the one after it must be a parent. If the indent level is the same or greater than the item after it, than that active tag is only a child.
01-15-2021 09:07 PM
Thank You for the Help. I was able to figure it out. I have to apply some logic to determine if the parent doesn't have any child, not to copy because there is nothing to copy, but the main code that I needed is there.
01-17-2021 08:30 PM
You should use an event structure, no need to continuously poll the button. See below. Also some basic error checking should be done.
Rough draft, can be improved.
2018 Version attached.
mcduff
01-19-2021 06:43 PM
Hello mcduff,
Thanks for the feedback. my actual code is event driven. I just threw something together to get the point across in the forum. I do like what you have done here though, I did not know about the get child vi library so that is helpful.
Thanks
01-19-2021 08:55 PM
@PGgautam1 wrote:
Hello mcduff,
Thanks for the feedback. my actual code is event driven. I just threw something together to get the point across in the forum. I do like what you have done here though, I did not know about the get child vi library so that is helpful.
Thanks
Use VIPM to install “Hidden Gems” of the VI library; that vi and some other tree gems will be accessible on your palettes.
mcduff