06-16-2011 04:48 AM
Hello,
i have a string indicator that is limited to a special nuber of lines that can be changed during runtime.
In this indicator i show logging-infomations what is currentyl send and read on the comport.
Now i want to display the lines in different colors dpending on the comport. The lines can be separated with ">" (for send data) and "<" (for recived data).
I already found this article in the forum:
http://digital.ni.com/public.nsf/allkb/6BD344ACA4DEE20A8625692700737E16
Does someone have an idea how to bring this into my form? The problem is that the Start and Stop index is different because line2 becomes line1 if the MaxNumerOfLines is reached in the string-indicator.
So i need something like a subvi where the whole content of the indicator, a character and a color is input....
But how to do this?
The string indicator should look like this (there is one line for each telegram)
2011.02.02 : COM7 > hello
2011.02.02 : COM8 < hello
2011.02.02 : COM7 > hello
2011.02.02 : COM8 < hello
2011.02.02 : COM7 > hello
2011.02.02 : COM8 < hello
2011.02.02 : COM7 > hello
2011.02.02 : COM8 < hello
Or any other ideas how to make the log more readable. Currently you have to look for the > or < to see if it is a send or read data.
Thanks for help
Solved! Go to Solution.
06-16-2011 06:55 AM
06-16-2011 07:49 AM
Hi Jim,
thanks for your solution. Works perfect but its to solow to use it 😞
The String-field gets too fast new values and with each new line i have to rebuild all colors because the lines are switching.
And then it begins to blink and looks strange because the color upate is from top to down and not all at the same time.
06-16-2011 07:58 AM
Use a producer/consumer architecture. Let the string indicator change color while your producer loop collect new data. Then update the string indicator when you want to.
06-16-2011 08:02 AM
This is what i currently do.
I have a queue taht is filles by other steps and the log-vi that reads out the queue all 50ms.
In the log-vi i just take the current content of the string-indicator and "concatenate" it with the new queue-content - then the result goes back in the string-indicator.
06-16-2011 08:29 AM
I added an example to show my blinking problem.
I used Jims solution, put in in a subvi and added a reference as input. Then i pass static text to the subvi.
Normally the color should change only once - why is it blinking?
Thx
06-16-2011 09:29 AM
your simply loop structure make it blinking.
you can use event structure, state machine or other structure to avoid it.
06-16-2011 09:34 AM
But why does the text-color go back to black after i changed it to red?
At the end of teh loop all text is correct colored (can be seen with beakpoint. But at the start of the next loop everything goes back to black.
Seems as if the changed reference-values inside of the sub-vi get overriden at the next call...
Makes no sense that it blinks.
06-16-2011 11:58 AM
Try Deferring Panel Updates.
10-14-2015 07:49 PM
Is there a way to change font color on the fly and not to scan through the entire string. This is helpful when the string size gets large. For example, we keep the font color format of the existing string and only format the most recent concatenated lines.