LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight Row in 2D string array

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.

0 Kudos
Message 1 of 8
(5,382 Views)

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

0 Kudos
Message 2 of 8
(5,345 Views)

A Table control is easier to manipulate this way.  Are you able to change the Array control/indicator to a Table?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 8
(5,342 Views)

@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)

 

 

0 Kudos
Message 4 of 8
(5,341 Views)

@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 🙂

0 Kudos
Message 5 of 8
(5,338 Views)

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

0 Kudos
Message 6 of 8
(5,334 Views)

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

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 8
(5,324 Views)

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").

0 Kudos
Message 8 of 8
(5,316 Views)