05-29-2020 10:48 AM - edited 05-29-2020 11:04 AM
Hi all!
In the attached image you can see the "SelColor" property under "ActiveCell" but the color of the selection changes for every single row.
I was wondering if it's possibile to use the "Selection Color" property of a Multicolumn Listbox for the current active row only.
This is an alarms' listbox, I'd like to keep the red color for alarms' selections and the yellow color the warnings' selections.
Thank you!
Solved! Go to Solution.
05-29-2020 01:49 PM - edited 05-29-2020 01:51 PM
You typically get better help if you would attach a simplified VI instead of pictures.
The selection color is whatever is currently selected and not tied to any specific cell. It also depends if the option "highlight entire row" is set. Can you clarify exactly what behavior you want?
05-29-2020 03:52 PM
Sorry, no. The selection color always applies to all cells.
But you could write code that changes it on the fly depending on which row is selected.
06-02-2020 04:03 AM
Hi! Thanks for the reply.
How can I activate the color change everytime i select a row? Event Structure? Thanks!
06-02-2020 06:48 AM
Try something like this:
That might be OK, but it might flicker. If it does, do something like this instead:
06-02-2020 08:40 AM - edited 06-02-2020 08:45 AM
Thanks again for your precious help!
Your example works with single column listbox, I have a multicolumn one but I edited your code and tried it in a separeted VI, it works!
I simply get the color I need from a reference cell in the same row of the selected one and set the selection color.
Now the second issue: as you can see in the attached pictures I need to continuously run the "main cycle", which fills the listbox cells, while I check the selected row as you showed me, is there a way to make this work? The VI I attached doesn't work, I also tried to insert the "main cycle" in the "Timeout" case of the event structure but it doesn't work.
Thanks!
06-02-2020 10:26 AM
@CarfRip wrote:
Thanks again for your precious help!
Your example works with single column listbox, I have a multicolumn one but I edited your code and tried it in a separeted VI, it works!
I simply get the color I need from a reference cell in the same row of the selected one and set the selection color.
Now the second issue: as you can see in the attached pictures I need to continuously run the "main cycle", which fills the listbox cells, while I check the selected row as you showed me, is there a way to make this work? The VI I attached doesn't work, I also tried to insert the "main cycle" in the "Timeout" case of the event structure but it doesn't work.
Thanks!
It doesn't work as shown because the loop will iterate after everything inside it has finished. The event structure waits for an event, so it won't finish until an event happens. When you put the Main Cycle in the timeout case of the event structure, what did you set the timeout to?
06-02-2020 01:20 PM
Poor me... I didn't set the timeout 😪
Now it works like a charm! Thank you so much Paul 😁