LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tree control: How to disable the selection of a child item

Hello everyone,

Im having trouble with disabling the selection of a child item in a tree control. I dont know if its possible but havent found any answers on this forum regarding this issue.

Example:

Parent tag 1
    child item 1
    child item 2

Parent tag 2
    child item a
    child item b
--------------------------------------------------------
What i would like to do is being able to select the parent tags but not the child items, because i use the name of the selected item in my program to determine which actions are allowed and those that are not. To avoid this problem i look at the first 4 letters of the name and this way i can determine if it is a parent tag or child item and take appropriate action. Im able to do this because the parent tags have fixed names. But even though nothing happens in software if i select a child item it still lights up, so for the user of the program it looks as if the child items is selected but the program doesnt do anything(because i made it that way). Thats why i want to be able to disable the selection of the child item or at least make the selection colour of the child item transparant so it doesnt look like it is selected.

Can anyone help me with this problem, if there are parts of my question you dont understand, just ask.

greetz
Ynse.
0 Kudos
Message 1 of 17
(6,556 Views)
Hope this helps
Download All
Message 3 of 17
(6,540 Views)
Using property node.Choose a value from 0 to 2.(Right click property node ---->Change all to write)
Message 4 of 17
(6,539 Views)
Muks,

your last image disables the whole tree.

To programmatically disables an item use ActiveItem.Disabled? property.
Unfortunately this only has two states, Enabled and disabled (thus grayed).

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 5 of 17
(6,527 Views)
Thanks for the replies.

Is it also possible to disable an item from the block diagram (in software), without disabling the entire tree and getting the item grayed out.
Another option would be to have 2 different selection colours, one for the parent tag and one for the child item (transparent), does anyone know if this is possible?

greetz,
Ynse.
0 Kudos
Message 6 of 17
(6,521 Views)
Hi ton,
           You are right.I thought wiring 0,1,2 will induce 3 different states but unfortunately that is not the caseSmiley Sad.Thanx for sorting it out
Message 7 of 17
(6,516 Views)
You can disable the items. If a for loop, set each tag to ActiveItemTag, and
then disable it, or fill the DisabledItems property.

AFAIK, it's not possible to disable items, without changing their color to
grayed out.

When a user selects an item, you get a value change event. If you get such
an event, and the item may not be selected, set the value to it's previous
value (also returned by the event structure). This is another way to prevent
items to be selected, but you'll see a flash when an illegal item is
selected.

Regards,

Wiebe.



Message 8 of 17
(6,503 Views)

"ynse" <x@no.email> wrote in message
news:1217419807993-753469@exchange.ni.com...
> Thanks for the replies.Is it also possible to disable an item from the
block diagram (in software), without disabling the entire tree and getting
the item grayed out.

Read TonP's last post.

>Another option would be to have 2 different selection colours, one for the
parent tag and one for the child item (transparent), does anyone know if
this is possible?greetz,Ynse.

Select the item you want to change with the ActiveItemTag property. This
doesn't select this item, it's just to tell LabVIEW that all properties you
are going to change effect this item. Then, use the property nodes under
Active Item and Active Cell (also set Active Column Number) to change font
and color properties.

Regards,

Wiebe.


0 Kudos
Message 9 of 17
(6,481 Views)
Thanks for the tips everyone, i think i can put something together now with the provided info.
If i get lost in the code, i'll be back to ask for help Smiley Very Happy

greetz,
Ynse.
0 Kudos
Message 10 of 17
(6,480 Views)