LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree Index handling

Hi,

 

I have a bit problem understanding the tree relevant index..

 

I have a tree that looks like that

 

1. Pretest

1.1 25 C

2 Full Test

2.1 25C

2.2 75C

2.3 -17C

 

when I'm putting this labels the index's are 1 to 5...... Now when I want to add items to my tree it always mess up 🙂

 

1. Pretest

1.1 25 C

2 Full Test

2.1 25C

2.1.1 Loop 1

2.1.2 Loop 2

2.1.3 Loop 3

2.1.4 Loop 4

2.1.5 Loop 5

2.2 75C

2.2.1 Loop 1

2.2.2 Loop 2

2.2.3 Loop 3

2.2.4 Loop 4

2.2.5 Loop 5

2.3 -17C

 

I tried to use the examples but what I want is a "dynamic" access to my tree I want to be able to add item to a specific location programmability are there any good examples ?

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 4
(2,807 Views)

Hey Kobi,

Yes you can have dynamic access to your tree I believe, by that I mean you can add, insert, delete items from your tree. All the functions that are available for the tree controls are listed in CVI under Libraries » User Interfaces » Controls/Graphs/Strip Charts » List/Tree Controls » Tree

 

from that list you can pull in and perform whatever action you want. Also here is an example of editing tree items(not exactly what you were asking for but should give you an idea of how to handle user events) http://zone.ni.com/devzone/cda/epd/p/id/3155, you can also look C:\Users\Public\Documents\National Instruments\CVI2010\samples\userint\events.prj

is a nice example.

 

Hope this helps to get you moving.

BeauH
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,797 Views)

Hi,

 

Thank you for the response , I will try to define my question better because I know all the examples...

 

I'm trying to understand the working method with the index because I'm doing it wrong..

 

My tree starts as a blank tree and the software need to fill by the results.... ( it can't be recursive )

 

at the first stage I'm filling it like that:

 

0. aaa

1. bbb

 

Then I need to go to index 1 and give it chilled....

 

0.aaa

1. Child 1

2. Child 2

1. bbb

 

The automated index for child 1 is 1 because his parent is 0.... So far so good.

 

But if now I want to go to the "real" index 1 ( נbb ) and give him a chilled I will get this wrong result

 

0.aaa

1. Child 1

2.child of b

3. child of b

1. bbb

 

I'm getting this result because I'm entering in the relative index 1 in the wrong branch which isn't  the index of bbb....

 

I hope it's clear , I couldn't find any example of this kind a simple programmability tree editing

 

thanks for your help.

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 3 of 4
(2,794 Views)

Hey Kobi,

 

As long as you know the Label of your Tree items you can use the GetTreeItemFromLabel()  

Example:

GetTreeItemFromLabel (panelHandle, PANEL_TREE, VAL_ALL, 0, VAL_FIRST, VAL_NEXT_PLUS_SELF, 0, "Fourth", &index);

 

the relative index is returned in 'index' you can use that index to then InsertTreeItem at the desired index. 

Keep in mind that siblings index is are shared by all the siblings. 

 

Enjoy your Holiday

 

 

BeauH
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,775 Views)