Jump to content

How to assign a different color to each line of a String Indicator ?


Recommended Posts

Posted

Hi guys,

Would it be possible to assign a different color to each line of String in a String Indicator ?

The only thing a know is that when you try to modify through a property node it changes all the lines of the string indicator ...

This might be possible but how ?

regards

Posted

You need to select the text you want to color before applying the new color. The string control has two properties for the selection start and end points. I don't remember if there's a separate property for the selected text color, but I'll leave you to work out the details.

Posted

First, thanx for your answer. I did try to use the selection option of the String Indicator's property node. The problem is can't make it work.

I added the elements

"Text.SelStart" '2' (2 means the start of selection is the second Byte if i'm not wrong)

"Text.SelEnd" ' 5'

"Text.TextColor" '0' (for black)

for example. The thing is I don't see any change in the String indicator.

Posted

The key is that you need to change the font color, not the text color. The text color property changes the color for the entire text.

  • Like 1
Posted

Hi again,

I have the feeling that this trick works OK with a String Control but not with a String Indicator ... I made a few tests and my only results were with String Control ... Am I missing something ?

Posted

Hi again,

Sorry I might be a fool but the link you previously posted isn't working for me, I'll look for the tutorial anyway.

While I'm here I just want to know why the use in my VI of the FontColor modification doesn't work ... You guys are so clever that you may find the origin of the problem ...

Here is the picture of my VI

post-15995-124714103884_thumb.jpg

thanks a lot

Posted

While I'm here I just want to know why the use in my VI of the FontColor modification doesn't work ...

I've started a new thread because I think it's a bug. But let's hear what the others have to say about this: it could be intended behavior.

To answer you problem directly, I think it has to do with the fact that whenever you append a string, the whole string will revert to it's last color setting and dump all font color info you've set.

Follow this link to get a hint at what I'm saying.

Posted

I agree with Omar.

You should check out the Listbox.

It looks much easier to work with. I use it a lot.

The JKI tutorial Omar references may be to much to start with.

Here is a picture of simpler code to get started.

post-3149-124758439593_thumb.jpg

Posted

Hi again,

Sorry I might be a fool but the link you previously posted isn't working for me, I'll look for the tutorial anyway.

While I'm here I just want to know why the use in my VI of the FontColor modification doesn't work ... You guys are so clever that you may find the origin of the problem ...

Here is the picture of my VI

post-15995-124714103884_thumb.jpg

thanks a lot

What is the value of the 'reads' variable at this state? can you probe it to make sure there is no funny value for it before adding another 85 to it?

  • 2 weeks later...
Posted

Hmm yeah, I checked these read values and semmed to be ok ... but it's not so important because I put this value just to see if there was a different color at a point in the String. I tried with a lot of different values.

Listbox seems to be great for this purpose... I will check it out !

Thanks for your help guys.

PS: Sorry for the late answer, I did put this feature aside for a moment and worked on the rest of my project.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.