Discussion:
How to use the TreeControl's active item indent level
(too old to reply)
10Degree
2008-08-07 12:40:08 UTC
Permalink
I am trying to query the indent level of an item in a TreeControl when I double-click the item.  I have an event structure that captures the double-click event.  In the handler, I read the Active Item:Indent Level property but it returns an error:
 
Error 1135 occurred at Property Node (arg 1) in Viewer Main.vi
 
Possible reason(s):
LabVIEW:  The tree control's active item is not valid for this property.
Property Name: Active Item:Indent Level
 
Does anyone have code to show how to access the indent level for the Active Item?
 
Thanks,
-cb
Wiebe@CARYA
2008-08-07 14:29:02 UTC
Permalink
I think the Indent Level is the number of pixels child items are indented.
It seems to me you are trying to determine how many levels the items is?

If so, you can do that by querying an items parent, and repeat that for each
returned item, untill you get an error.

It's easier to give each item a tag that has this information in it. For
instance, a parent is called a, it's child is called a\b. You can put all
sorts of information in the tag, so you don't have to look it up when the
item is selected.

Regards,

Wiebe.
10Degree
2008-08-07 14:10:05 UTC
Permalink
Thanks Wiebe, that is very helpful.  I think that the TreeControl could be more programmatically robust.
-cb
smercurio_fc
2008-08-07 14:40:07 UTC
Permalink
10Degree wrote:
Thanks Wiebe, that is very helpful.  I think that the TreeControl could be more programmatically robust.
In what way? The error you got seemed like a perfectly valid error for an invalid operation. How is this not robust?
10Degree
2008-08-07 14:40:10 UTC
Permalink
smercurio_fc,
 
I may not be using the control properties correctly.  The help for Active Item:Indent Level indicates that it will return the Item Indent value for the active selected tree item.  The indent level indicates the depth in the tree at which the item exists.  For instance, a value of 2 indicates that the item is a Child of a Child of a Root node.  When I try to access the property, I get an error.  I have attached a simple VI (8.2.1) that shows the error and the basics of how I was trying to use it.  Can you point out my error or provide a corrected VI? 
 
Thank you,
-cb


Get tree control active item indent.vi:
http://forums.ni.com/attachments/ni/170/347556/1/Get tree control active item indent.vi
smercurio_fc
2008-08-07 15:10:07 UTC
Permalink
Your example is actually in 8.5, not 8.2.1. In any event, you're trying to access a property of the active item. The problem is that there's no active item (even if you double-click). That's why the error gets generated. Take a look at the example VI "Tree Enhancements" that ships with LabVIEW. It shows you how to access the indent level.
10Degree
2008-08-07 17:40:06 UTC
Permalink
Thank you.  That example clears up a number of questions.

Loading...