LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Hi everyone,

 

I have some more questions (regarding the same subject) and this time i have pictures to help clearify things. 

In "src1" you can see the Parent item "PAAC1" with several child items beneath it. In the previous replies it was suggested to disable the child items so that i cant select them, but then they all appear grayed out, and that's something i dont want. Another thing is that the content of the Tree is not fixed, you can load different files so enabling/disabling the items via front panel is not an option. What i want to do is be able to select PAAC1 (parent tag) and none of the hild items below it without graying them out.

 

The second problem i have is that when i select an item in the tree, then clear the tree, and load the same file agian, the same item i selected earlier lights up, even though the active item property of the tree indicates that nothing is selected. How can i fix this? If i load a different file with different parent tag en child items, no item lights up. Probably because they are different variables from the first time?

 

Thanx in advance.

Greetz ynse. 

Download All
0 Kudos
Message 11 of 17
(1,640 Views)

Hi,

 

you can forget about the disable, grayed out problem, wiebe already answerd this in prevoius reply. (i overlooked it) 

Apparently it isnt possible to disable a tree item without graying it? 

 

greetz. 

0 Kudos
Message 12 of 17
(1,638 Views)

"ynse" <x@no.email> wrote in message
news:1225357807084-801043@exchange.ni.com...
> Hi,&nbsp;you can forget about the disable, grayed out problem, wiebe
already answerd this in prevoius reply. (i overlooked it)&nbsp;Apparently it
isnt possible to disable a tree item without graying
it?&nbsp;&nbsp;greetz.&nbsp;

In Windows, disabled means grayed out... Changing the font color will work,
but the color will still be dimmed...

That doesn't mean you can make it behave like you want to... You need to
catch the value change event of the tree. If an item is selected that you
don't want, put the old value in a local of value property node. Or the
value of it's first parent that is allowed to be selected. You might see a
small glitch, since the selected value might be highlighted by LabVIEW
before you can change it.

Regards,

Wiebe.


0 Kudos
Message 13 of 17
(1,620 Views)

Hi all,

as Wiebe posted I made an example which illustrates this (in fact, I made it for my own exercise). My solution has a drawback since Key- navigation is not satisfying. To illustrate this, enable the code in the "Key down?"- even, run, click on "Parent 1" and press the Down- key on keyboard. Now "Parent 2" ist selected (or highlighted or whatever). If you then press the Left- key, all child- items under "Parent 2" should be hidden, but the indended items under "Paren 1" are. Why??? There is the little grey frame around "Parent 1", But how to move this?

With the disabled while- loop on block diagram I tried to explore the sense behind active cell but failed.Who has an idea?

 

greets, Dave

 

 

Message Edited by daveTW on 10-30-2008 12:05 PM
Greets, Dave
0 Kudos
Message 14 of 17
(1,609 Views)
Active cell has nothing to do with the highlighted value in the tree. Active
Cell, like Active Item.tag, is a property that can be set so other
proprtyies, like all the font stuff, know you want to act on that tag and
cell. For instance, set Active Item.tag to a valid item, and Active Cell to
0. Then set Active Item.Cell Font.Italic to true, and the text of the
selected tag becomes italic...

If you want to set the tree to a certain item, simply put the path in a
local, value or value (signaling) property of the tree.

Regards,

Wiebe.


0 Kudos
Message 15 of 17
(1,586 Views)

I didn't really look at your code untill now...

 

It is way to complicated! Why catch keys? You can easilly see if you're going up or down. Also, you get the old value, so why put it in a shift register?

 

See attachment. you only need to use the value change event. The code for this sort of stuff gets ugly very fast, so all of it (everything in the value change event) should be put in a sub VI (also so you can reuse it).

 

In the example, I use a regular expression to disable items. If there is a "1" in the tag, it is disabled. Everything can be used...

 

 

0 Kudos
Message 16 of 17
(1,599 Views)
And if someone feels like it, please kudo this, instead of the mail with
attachment... Somehow I can't get my outlook to use the same account as my
web interface, and outlook can't send attachments to the forum anymore...

Regards,

Wiebe.


Message 17 of 17
(1,597 Views)