LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading second column in Tree control

I'm trying to use the Tree control in Labview 7.1
I think I've figured out most of the quirks with the control, but I really would like to use a second column and I don't know how to add data to the second column and how to read data from that second column (the idea would be you select (by double clicking) on an item in the tree and I would like it to reutrn the parent name, child name and the data in the second column).
 
Anyone good with the tree control?
 
Thanks
Chuck
0 Kudos
Message 1 of 10
(6,958 Views)
Hi Chuck,
 
Here's a screenshot showing the answers to your questions.  For the benefit of users searching the forums, the text from my comments in the diagram screenshot is given below:
 
 
Add Item Method:  "When adding tags with this method, wire in a 1D array to the Child Text input. The elements of this array are the 2nd, 3rd, 4th, etc. columns."
 
Get Parent Method:  "Here's how you can get the Parent tag of the double-clicked item"
 
Various properties:  "To get the text of the second column, first set the "ActiveItemTag".  Then set the "ActiveColNum".  Once you've done that, you can read the cell string of the active cell, which is the second column of the row specified by ActiveItemTag."
 
Note:  I did all of this in LabVIEW 8.0...I'm *pretty* sure all of these properties/methods are available in LabVIEW 7.1.
 
Good luck,
-D

Message Edited by Darren on 09-28-2006 09:07 PM

Message 2 of 10
(6,949 Views)
Thanks loads Darren.  Very helpful.  I knew I was close.
0 Kudos
Message 3 of 10
(6,937 Views)

Ok here is another dumb question.  How do I indent items I want to be child items?  I've tried different values (-1,0,1) into the child position array, but nothing there seems to work (at least the way I've tried to understand the help).  So far everything I've tried ends up at the root level.

I want to do this

+--A
   |
   +-- B
   +--C

and i'm getting this

+--A
+--B
+--C

0 Kudos
Message 4 of 10
(6,932 Views)

Oh and another dumb question?

I don't quite get the point of the parent tag.  Or more specifically, why they let you wire to the parent tag.  I understand its supposed to be a unique identifier, but when I wire to it with unique values, it gives a 1008 error.  If I don't wire it, it generates its own tag values.

0 Kudos
Message 5 of 10
(6,930 Views)

Ok.  I figured out my questions I raised above, but now I have another and hopefully final question.

How do you get any data (tag, whatever), from the tree control with a single click (I'm using the mouse up event).

With the double-click you get the tag item in the event structure, but you don't get that with a mouse up event.

What I had in mind was that when you did a single click it on the tree control it would display details regarding what

was selected, and when you double-click it would let you edit those details.

0 Kudos
Message 6 of 10
(6,923 Views)
Hi,
To get the tag in "mouse up" event, you can wire "Coords" to "Point to Row Column" method of tree control.
This method converts a pixel coordinate to a tag-column pair in the coordinates of the control. It also returns whether the point is inside the bounds of the content rectangle and whether the point is within the custom symbol of the cell.
0 Kudos
Message 7 of 10
(6,918 Views)


@ttrr wrote:
Hi,
To get the tag in "mouse up" event, you can wire "Coords" to "Point to Row Column" method of tree control.
This method converts a pixel coordinate to a tag-column pair in the coordinates of the control. It also returns whether the point is inside the bounds of the content rectangle and whether the point is within the custom symbol of the cell.



Does this method appear in Labview 7.1 cause I sure don't see it.
 
If not does that mean you can't use a mouse up event for a tree control?
 
0 Kudos
Message 8 of 10
(6,911 Views)
The "Point to Row-Col" method mentioned by the previous poster is not available in LabVIEW 7.1, but a VI that has the same functionality is.  Look in the vi.lib\tree folder for the Point to Row-Column VI.  But instead of using Mouse Up, why not just use the Value Change event on the Tree Control and read the selected tag from the control terminal directly?
 
By the way, don't feel bad about asking so many questions...I was one of the first people to do a lot of work with the tree control (and this was in LabVIEW 7.0 before it was even alpha), so I remember having these same kinds of issues...although, when I got really stuck, I guess I did have the advantage of asking the developer who was actually writing the feature... 🙂
 
-D
Message 9 of 10
(6,911 Views)


@Darren wrote:
The "Point to Row-Col" method mentioned by the previous poster is not available in LabVIEW 7.1, but a VI that has the same functionality is.  Look in the vi.lib\tree folder for the Point to Row-Column VI.  But instead of using Mouse Up, why not just use the Value Change event on the Tree Control and read the selected tag from the control terminal directly?
 
By the way, don't feel bad about asking so many questions...I was one of the first people to do a lot of work with the tree control (and this was in LabVIEW 7.0 before it was even alpha), so I remember having these same kinds of issues...although, when I got really stuck, I guess I did have the advantage of asking the developer who was actually writing the feature... 🙂
 
-D



Awesome idea!  I'll check out the Point to Row-Column vi as well.  I usually use Mouse Up cause it has worked well for me in the past.  Didn't think of the value change event.

Thanks
Chuck

Message 10 of 10
(6,908 Views)