From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree Control - Parse array of strings to

Solved!
Go to solution

I'm trying something new. I want to use a tree control as a menu, but I really have not worked with the tree control before. I have a database that I read containing menu items of varying depths.

 

I think that I'm pretty close as you can tell if you run the attached VI. The problem is that I get this for an output:BadMenu.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When I really want this:

 


GoodMenu.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Is there any way to do this using a specific command in the Tree API or do I really need to parse it out in specific arrays (tough because of tracking the depths)? Is this overkill for a menu? Am I parking up the wrong tree?

 

The attached VI is in 8.6.

0 Kudos
Message 1 of 8
(3,798 Views)

Have you tried dragging and dropping the items (with ctrl) onto the segments that you want them to be nested under?

 

This is what I was able to come up with by just dragging things around. 

 

image.png

0 Kudos
Message 2 of 8
(3,761 Views)

Instead of "Add item to end", I think you need to just use "Add item", which allows you to specify a parent tag.  If you specify a parent tag, you can explicitly say which string you want nested under which other string.  You might have to redo your formatting and parsing.

 

Also, you need to enforce dataflow on your two property nodes.  The way you have it now, either one could randomly run first.

Message 3 of 8
(3,757 Views)

Thanks for replying!!

 

The one thing that I wasn't clear on is depending on the type of system the user selects, the menu is dynamic hence the reason for having to read a database. So, moving items around to get them in the proper order would not work. After reading the database, the menu just has to be.

 

Kyle - I'll try the Add Item method and report back.  Thanks for the prompt that there are other methods to work with and try out.

 

 

0 Kudos
Message 4 of 8
(3,746 Views)

Barking....  😄  not Parking!!!

 

BTW: Anyone have thoughts on this?  I may have gotten closer to what I want, unfortunately I have had to set it aside for a little bit.

0 Kudos
Message 5 of 8
(3,727 Views)
Solution
Accepted by topic author m3rl3n

@m3rl3n wrote:

BTW: Anyone have thoughts on this?  I may have gotten closer to what I want, unfortunately I have had to set it aside for a little bit.


It's ugly but it works (I think).

 

fp.PNG

 

BD.png

Message 6 of 8
(3,710 Views)

Thanks Jamiva!!!

 

I'll go through it here in a little while. Yes, it does the sorting perfectly.  Thanks, now I know it can be done.  I was sure it could be but I don't know the tree API as well as maybe I should.

 

Dan

 

0 Kudos
Message 7 of 8
(3,703 Views)

Jamiva, nice solution and not ugly at all!

2 improvements:

You can get the tag directly but either Reverse string and search for * (and reverse it back) or there's a reg exp character that searches from the back.

The Tree all tags should be kept in a shift register so you don't need to read from the Control for more speed.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 8
(3,679 Views)