LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree Control - Multi-select highlight color

Hey everyone!

 

I am trying to enable a "0 or more items" tree control where the multiple selections are highlighted with a different color.  I am very close to achieving the functionality that I want, but I lose the first column text when changing the BG color of the row. I have even tried to set the cell font color to black, but the text remains invisible.  Oddly, all other columns text remains visible.

 

See the screen shot below. The blue and green rows have text in "Col1" but it seems to be set to the same color as the BG, making it invisible.  

 

Any ideas how to get around this? I attached a simple VI to demonstrate the issue.  

 

Jguglielmo_0-1756842511631.png

 

0 Kudos
Message 1 of 4
(200 Views)

Your issue is with the selection color. If you play with that (and with the select entire rows property which you also set in the beginning), you should see some changes. I haven't tried looking at what the actual behavior is in detail.

 

Personally, when I have something like this, where I want custom functionality, I try to handle the entire functionality separately from the control and use the control just for the display. In your case, I expect this could be implemented by changing the control to be an indicator, using the mouse down? event instead of the value change event and maintaining your list of "selections" separately (probably as an array of clusters or similar, updated based on the mouse down events) and using that to update the appearance of the tree. You should also think about how you handle keyboard events.


___________________
Try to take over the world!
Message 2 of 4
(137 Views)

Thanks tst.  I tried playing with the selection color but there can only be one color, so all of the colors set by the BG property are covered over by the single selection color.  That is because I am relying on the items actually being selected (IE ctrl-clicked), instead of psuedo multi-selected by forcing only one selection but still BG coloring the others.  

 

I have been hesitant to switch to mouse down as I find tracking coordinates to be overly complicated for what I am doing, and I'd have to manage keyboard events as well.  This is 95% covered in the way I am doing it, but the dang text disappearing is a deal breaker.  

 

Thanks for you ideas. I may at least switch to tracking the "selections" in a separate array and make the tree a 0 or 1 type instead.  

0 Kudos
Message 3 of 4
(106 Views)

@Jguglielmo wrote:

 

I have been hesitant to switch to mouse down as I find tracking coordinates to be overly complicated for what I am doing, and I'd have to manage keyboard events as well.   


The mouse down event gives you the coordinates and the tree control has a "Point to Row Column" method which converts it the specific point (although I expect you probably have to handle the edge cases like the scrollbar, headers, etc. I'm assuming the outputs of the method help with that).

 

For keyboard stuff, my recommendation would be to simply not support it. If you're going to have multiple active selections, the UX for the keyboard behavior is ambiguous anyway, so the easiest option is to say "the keyboard does nothing".

 

 


@Jguglielmo wrote:

...I am relying on the items actually being selected (IE ctrl-clicked), instead of psuedo multi-selected by forcing only one selection but still BG coloring the others.  


Again, my experience has been that when you have some custom behavior like this, it's usually better to handle everything yourself instead of relying on the control to handle part of it for you. Having everything handled separately usually avoids issues with how the control behaves and makes it easier to understand the behavior.


___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(68 Views)