04-13-2017 08:55 AM
Is there a good way to highlight a row in a 2D string array I found This post on highlighting elements of a 1D array but I can't seem to get it to work for a row of a 2D array.
04-13-2017 09:55 AM
What, exactly, do you want to do, and how do you want it to look? As I'm sure you know, you cannot change the properties of an element of an array -- all elements have the same property. What you can change are the values of the Array elements. Once I wanted to make a Status Display for 24 stations, with Green being Good, Red being Bad, Yellow being Inactive, and Black being Off. What I made was an array of little picture boxes, which I set to various colors.
I'm currently working on a revised version of this routine, and wanted more flexibility. Specifically, I wanted an "array" of 24 Boolean LEDs (did you know that you could also use them as Controls?), and wanted to change their properties on an individual basis (for example, to change their color). I did this by creating 24 separate Boolean Controls, arranging them nicely on the Front Panel, and Grouping them (so they move as a unit). I create an Array of References to them, then wrote an Action Engine that takes a Station Number (1 .. 24) and an Action ("Green", "Red", "On", "Off") and programmatically changes the relevant Property (Color or Value, for example). A little clumsy to create (once), but works well in practice ...
Bob Schor
04-13-2017 09:59 AM
04-13-2017 10:05 AM - edited 04-13-2017 10:09 AM
@Bob_Schor wrote:
What, exactly, do you want to do, and how do you want it to look?
I have a 2D array of strings in an indicator array that act as instructions for my vi set up like:
Element Value A Value B
Element-1. Value 1A Value 1B
Element-2. Value 2A Value 2B
Element-n. Value nA Value nB
When my vi is working on Element 1, I would like it to alter the indicator array such that Element-1, Value 1A, and Value 1B are made unique in comparison to the rest of the set (either Highlighted or in bold)
04-13-2017 10:08 AM - edited 04-13-2017 10:09 AM
@jcarmody wrote:
A Table control is easier to manipulate this way. Are you able to change the Array control/indicator to a Table?
I can do that, My question would then be how to do this for a table 🙂
04-13-2017 10:09 AM
As I stated before, any property you apply to one Array element is applied to all. Something you could do (but it would be a lot of work) is to figure out where, on your Front Panel, the relevant entries were located, and use a Picture Control to draw a box around that portion of the screen ...
Bob Schor
04-13-2017 10:31 AM
Using a table...
You can set the cell background color after setting the selected row/column using "Active Cell".
Read the help for the Active Cell to learn how to select an entire row or column.
Ben
04-13-2017 11:08 AM
I would use a multicolum listbox indicator, where the value is the row.
Now all you need is wired the row number and it will change to the selection color 😄
(Set properties to "highlight entire row", and selection mode "0 or 1 item").