09-27-2006 02:31 PM
09-28-2006 01:51 PM
09-10-2012 10:11 AM
I don't think the answer you gave here was quite what the question is asking about (I think I have the same problem)
Basically I am monitoring a comms port and I want to distinguish between the written and read information by changing the text colour depending on direction.
This involves me looping to monitor the port; when I get new data going either way I need to concatenate the new data with the old, but when I do this I lose any property changes that existed on the older text.
Does anyone know how to concatenate and preserve the properties of the input strings?
Cheers
09-10-2012 10:17 AM
I think what JLS has suggested will work. I will add that you can read the properties first using the property node and then right them back to maintain the same text color and bg. This way, you don't have to hardcore the colors in or "remember" what they were to begin with.
09-10-2012 10:59 AM - edited 09-10-2012 11:01 AM
Is it possible for you to create a quick VI in a while loop to show the following:
While(True)
{
Concatenate(
text with colour X
text with colour Y)
}
so in an output that preserves the text colour, so something like:
The dog The dog The dog The dog The dog
This is what i am basically trying to get, but i get the following:
Loop 1
The dog
Loop 2
The dog The dog
Loop 3
The dog The dog The dog
and so on...
Obviously I would change x = The to my writes and y = reads instead of constants once I can see how its done
Would really appreciate it - been banging my head on the desk all day =p
09-10-2012 11:50 AM
Something as simple as the attached would allow you to retain the color of your text. If your text is different colors however, I don't know that you can use two different colors once concatenated. You may have to go with one color, but there may be a way around this.
09-10-2012 12:18 PM - edited 09-10-2012 12:28 PM
So, on the front panel within the control you can select a certain amount of font, then set the color, and that color selection will only be applied to your selection. I tried to reproduce this on the BD but have been unable to. I have been digging through the properties, and I was hoping you could set the "selection" property (which you can) and then get a reference to your selection and set the color from there. But I see no reference to the selection. This is really a bummer, but maybe someone knows a work around.
If you were able to get the selection reference, you could change the selection in a loop, setting the end of the current selection to be at the next whitespace character. Then you could get/set all the words and their current colors. But, as I said, I don't currently see a way to do this.
09-10-2012 12:35 PM - edited 09-10-2012 12:36 PM
I did some further digging, and I don't know if you will like this idea, or how comfortable you are with active x but you could use the rich text box control. With the RTB you can set your selection, get a "selection font" reference, then set the selection color. You do all this using invoke/property nodes; Invoke to make selection, property nodes to change the color or get the current color. Does this work for you?
09-10-2012 12:47 PM - edited 09-10-2012 12:48 PM
@for(imstuck) wrote:
So, on the front panel within the control you can select a certain amount of font, then set the color, and that color selection will only be applied to your selection. I tried to reproduce this on the BD but have been unable to. I have been digging through the properties, and I was hoping you could set the "selection" property (which you can) and then get a reference to your selection and set the color from there. But I see no reference to the selection. This is really a bummer, but maybe someone knows a work around.
If you were able to get the selection reference, you could change the selection in a loop, setting the end of the current selection to be at the next whitespace character. Then you could get/set all the words and their current colors. But, as I said, I don't currently see a way to do this.
You don't need to use a reference. You can change the color of a particular section of text by first using the selections start/end and then set the font color:
If you're doing a loop then you can apply the same method to change the color by word.
09-10-2012 01:06 PM - edited 09-10-2012 01:10 PM
huh, I tried this and it didn't (apparently I did something wrong) work.
Edit: I used the Text.TextColors property instead of the text.FontColor property. The former sets the whole string, the latter just sets the selection. Frustrating.