LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Preserving font change in a string subset

Example_VI.png

 


@smercurio_fc wrote:

 

[...]

 

If you're doing a loop then you can apply the same method to change the color by word.


You beat me to it, but I reset the color of the existing text before reading your post.

 

I modified it and got an unexpected result:

Example_VI.png

 


 

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 11 of 23
(1,043 Views)

For two arbitrary strings and two arbitrary colors concatenated an arbitrary number of times you could do something like the attached. (Didn't put too much thought into it, so it's probably a bit "rube-ish")

Download All
0 Kudos
Message 12 of 23
(1,034 Views)

Don't think you quite get what I am asking for, in your example you are making it all one colour at the end, totally not what i was after.

 

I have attached something more accurate, you can see what i am trying to get in the expected string and what i am actually getting

0 Kudos
Message 13 of 23
(1,020 Views)

Smercurio_fc

 

Sorry let me try make it a little clearer cause I've played with what you sent and its not quite right.

 

Firstly its a while loop (dunno if that will affect anything), maybe its fine either BUT the big mean dog could change on the fly

 

One loop it could have Hello as a write in red followed by Hi

The next loop round it could have How are you? as a write and fine, you? as a read

 

Your example works if the text remains the same, but if i put String X and Y in the loop (with a while at the end so i can make changes to the text in between loops then ok it on) and the type what i type above, it loses the color formatting

0 Kudos
Message 14 of 23
(1,018 Views)

(Timed out on edit, wanted to tidy that up a bit and try add more clarification)

 

Smercurio_fc

 

Sorry let me try make it a little clearer cause I've played with what you sent and its not quite right.

 

Firstly its a while loop (dunno if that will affect anything), maybe its fine either way BUT the big mean dog could change on the fly

 

One loop it could have Hello as a write followed by Hi

The next loop round it could have How are you? as a write and fine as a read

 

Since as i am monitoring a comms port I might get several reads without sending a write, in which case I want all the read text to be blue, so i might get something like:

 Hello Hi How are you? fine *comms go quiet for a bit* So it was a bit warm today

 

Your example works if the text remains the same, but if i put String X and Y in the loop (with a while at the end so i can make changes to the text in between loops then ok it on) and then type what i type above, it loses the color formatting

 

Thanks for the attempt you got a lot closer than I did =p

Hopefully you'll know a how to get it this way

0 Kudos
Message 15 of 23
(1,014 Views)

Did you try my first snippet?  It does what I understand you to be asking for.

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 16 of 23
(1,011 Views)

@NIcurious wrote:

(Timed out on edit, wanted to tidy that up a bit and try add more clarification)

 

Smercurio_fc

 

Sorry let me try make it a little clearer cause I've played with what you sent and its not quite right.

 

Firstly its a while loop (dunno if that will affect anything), maybe its fine either way BUT the big mean dog could change on the fly

 

One loop it could have Hello as a write followed by Hi

The next loop round it could have How are you? as a write and fine as a read

 

Since as i am monitoring a comms port I might get several reads without sending a write, in which case I want all the read text to be blue, so i might get something like:

 Hello Hi How are you? fine *comms go quiet for a bit* So it was a bit warm today

 

Your example works if the text remains the same, but if i put String X and Y in the loop (with a while at the end so i can make changes to the text in between loops then ok it on) and then type what i type above, it loses the color formatting

 

Thanks for the attempt you got a lot closer than I did =p

Hopefully you'll know a how to get it this way


Ah, that changes the requirement considerably. What you're talking about has been asked about before. I remember someone asking about a "colorized Hyperterminal-like" VI, or something like that. Numerous suggestions were posted, like keeping track of the bits of strings that were added (along with the the colors), using a Listbox rather than a string, and even using a picture control instead of a string control since it's easy to add colorized text to a picture control.

0 Kudos
Message 17 of 23
(1,006 Views)

Will try yours now jcarmody, just i have a lot of places where i concatenate, gonna take a while to implement it this way, will give it a go and let you know what happens

 

Thanks for the suggestion

0 Kudos
Message 18 of 23
(1,002 Views)

I think this does work but it looks like it goes over all the text byte at a time and selects the color it previously was, I just worry this will take too much memory to sustain as the run time increases?

0 Kudos
Message 19 of 23
(1,000 Views)

This does seem to grind my VI to a halt pretty quickly 😞

0 Kudos
Message 20 of 23
(994 Views)