cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Tree Control - Parse array of strings to

Solved!
Go to solution

Tree Control - Parse array of strings to

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
(342 Views)

Re: Tree Control - Parse array of strings to

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
(305 Views)

Re: Tree Control - Parse array of strings to

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
(301 Views)

Re: Tree Control - Parse array of strings to

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
(290 Views)

Re: Tree Control - Parse array of strings to

Barking....  Smiley Very Happy  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
(271 Views)
Highlighted
Solution
Accepted by topic author m3rl3n
11-07-2018 11:29 AM

Re: Tree Control - Parse array of strings to


@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
(254 Views)

Re: Tree Control - Parse array of strings to

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
(247 Views)

Re: Tree Control - Parse array of strings to

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! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 8 of 8
(223 Views)