LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Highlighting row of String Indicator

Hi everyone,

i am currently trying to implement an VI that receives data via serial communication, and that data shall be displayed in a string indicator. The data is being sent by an stm32f4 Discovery Board. Every "message" has an CR+LF as an termination character.
Additionally the user has the option in the VI to specify "strings" in an array control. The VI shall search and match those specified "strings" in real time with the received data from the MCU, and if found, those strings/row shall be highlighted with a yellow background color.

I have not found any property, that allows me to freely change the background color of one single row. The best i could find was a workaround with "Selection start" and "Selection End", but i am curious if there is any easier and simpler approach to this.
I am also open for other alternatives instead of using string indicators, as they seem very limited. I tried using Listboxes as well, since they have the property to change "backgroundcolor" of active rows, but in my testing their performance was very slow compared to string indicators.

So to summarize my questions:
1. Is there any easier and simpler way to highlight rows in a string indicator?

2. Are they alternative options, instead of string indicators or listboxes?

I am currently on a train, which is why can't upload my code as an example (the wifi is really bad 😞 ), but i will try to do that as soon as possible.
Any suggestions would be very appreciated tho! 🙂

0 Kudos
Message 1 of 7
(217 Views)

When you upload your code, please upload LabVIEW code (which means VIs and TypeDefs).  You are probably using a newer version of LabVIEW than I (and many of the "old-timers" on this Forum), so I recommend that you "Save for Previous Version" and specify LabVIEW 2019 or 2021 before attaching your code.

 

Something you should know is that if you are using an array (i.e. an array of strings), LabVIEW won't let you format elements differently.  You could do "clever things" (like create a cluster with the string as the first element and a "flag" (an Enum, a Boolean, even another String) that acts as the "Highlight" (so if a Boolean indicator, you'd turn it "True", which usually "lights" the indicator).

 

Bob Schor 

0 Kudos
Message 2 of 7
(184 Views)

A "row" in a plain string is defined by the presence of column delimiter (e.g. linefeed,  etc.)

 

The easiest would be to turn it into a 1D array of rows and display it in a listbox.

Or you could turn it into a 2D array oy string and display it in a table indicator.

 

Both allow you to specify font (style, color, background, etc.) by cell, row, or column.

 

Once you attach a VI (downconverted to 2020 or below using "save for previous") containing a typical string, we can give more specific advice.

0 Kudos
Message 3 of 7
(172 Views)

You might find the method "Get Nth Line" useful.

paul_a_cardinale_0-1716756816477.png

Message 4 of 7
(166 Views)

If I needed this behavior and it was locked to lines like this then id stick with a list box. Can't really do disjoint selections and if you want several non-contiguous rows highlighted you'd run into issues.

 

There's also the QControl RichTextBox package that could let you embed styling inline and easily do portions of lines, entire lines, and a mix of both.

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
0 Kudos
Message 5 of 7
(156 Views)

@Bob_Schor wrote:

When you upload your code, please upload LabVIEW code (which means VIs and TypeDefs).  You are probably using a newer version of LabVIEW than I (and many of the "old-timers" on this Forum), so I recommend that you "Save for Previous Version" and specify LabVIEW 2019 or 2021 before attaching your code.

 

Something you should know is that if you are using an array (i.e. an array of strings), LabVIEW won't let you format elements differently.  You could do "clever things" (like create a cluster with the string as the first element and a "flag" (an Enum, a Boolean, even another String) that acts as the "Highlight" (so if a Boolean indicator, you'd turn it "True", which usually "lights" the indicator).

 

Bob Schor 


Hi Bob,
i quickly made an example project, of what i am trying to do and zipped it. As you requested, i saved the VI for LabVIEW 2019 version.
Hopefully this example shows what i am trying to achive with an string indicator. I am sorry for the long delay on this post.

Arkaru_0-1717060613373.png


I am trying to highlight the rows inside the string indicator with the matching string specified in the array. With "highlighting" i mean, the background color of that particular row shall be changed to yellow (any color would be fine tbh). And the highlighted rows should persists, even if more data is being read and appended to the string indicator.

Kind regards!

0 Kudos
Message 6 of 7
(107 Views)

Hi,

 

Does this help you ?

 

PinguX_0-1717061845687.png

 

As far as I know, we cannot change the background color of a part of a simple string indicator : either all or nothing.

So if you really want to change the background color and not font color or font style, you will need to choose another control on your front panel.

0 Kudos
Message 7 of 7
(102 Views)