01-07-2009 10:41 AM
I want to create a subvi to change the background color of a row in a listbox.
Why? The listbox contains commands parsed from an xml file. As various sections of the vi (front panel contains the multicolumn listbox) operateupon the commands they will call this subvi to remove the highlight from the command they processed and to highlight the next command in the multicolumn listbox.
A'
01-07-2009 10:55 AM - edited 01-07-2009 10:55 AM
I assume you know how to change the colors without using a subVI.
Just create a reference to your listbox and wire it as an input to your subVI. In the subVI, use a property node wired to that reference and do the same stuff.
01-07-2009 10:56 AM - edited 01-07-2009 10:57 AM
In a loop use the listbox's ActiveCell property to select the cell to be operated on and then set the color property. Repeat for each cell of each row you want to modify.
Mike...
PS: this does not work for system listboxes.
01-07-2009 11:04 AM
I was walking down that road but couldn't get the reference onto the front panel so I could wire it. Upon reading your reply I made a what the heck attempt to drag from block diagram to front panel - it worked. I'll forge onward from that.
A'
01-07-2009 11:24 AM
MrNatural wrote:I was walking down that road but couldn't get the reference onto the front panel so I could wire it. Upon reading your reply I made a what the heck attempt to drag from block diagram to front panel - it worked. I'll forge onward from that.
Here's a better way:
Create the property node in the toplevel VI , then select the property node and do a "edit...create subVI". Voila! You have the subVI with the connector (and the correct reference in the toplevel) all already hooked up correctly. 🙂
Now edit and save the subVI and reuse it anywhere.
01-07-2009 11:31 AM
mikeporter wrote:
PS: this does not work for system listboxes.
This is NOT true as of LabVIEW 8.0.
01-07-2009 12:09 PM
Thanks for all the good help. All is well with most everything except I cannot discern the property used by the GUI.
I can readily change the color of the active cell, including the entire row with column = -2.
I can creat a sub vi is a nice and tidy way.
But ---
If I use the "operate value tool" to select a row of the multicolumn list box, that row gets a dark blue background. However, I cannot determine which property will tell me or let me change that row number. I anticipate that whatever is that property, programatically changing it will accomplish what I need to do.
01-07-2009 12:30 PM
Excellent! I haven't tried this for a while but I felt that it was a rather arbitrary limitation...
Mike...
01-07-2009 01:38 PM
MrNatural wrote:But ---
If I use the "operate value tool" to select a row of the multicolumn list box, that row gets a dark blue background. However, I cannot determine which property will tell me or let me change that row number. I anticipate that whatever is that property, programatically changing it will accomplish what I need to do.
Can you attach a simplified version of your VI?