Xploit Posted July 6, 2009 Report Share Posted July 6, 2009 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 Quote Link to comment
Yair Posted July 6, 2009 Report Share Posted July 6, 2009 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. Quote Link to comment
Xploit Posted July 6, 2009 Author Report Share Posted July 6, 2009 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. Quote Link to comment
Yair Posted July 6, 2009 Report Share Posted July 6, 2009 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. 1 Quote Link to comment
Xploit Posted July 6, 2009 Author Report Share Posted July 6, 2009 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 ? Quote Link to comment
gleichman Posted July 6, 2009 Report Share Posted July 6, 2009 Indicators work just fine. Quote Link to comment
Xploit Posted July 6, 2009 Author Report Share Posted July 6, 2009 hmm ok that works ... my bad Thanks a lot guys Quote Link to comment
Omar Mussa Posted July 6, 2009 Report Share Posted July 6, 2009 Your best bet may be to use a listbox instead of a string indicator. This would make coloring each line trivial. Check out our JKI tutorial based on how we alternated colors for VIPM. Quote Link to comment
Xploit Posted July 9, 2009 Author Report Share Posted July 9, 2009 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 thanks a lot Quote Link to comment
Francois Normandin Posted July 9, 2009 Report Share Posted July 9, 2009 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. Quote Link to comment
McKman Posted July 14, 2009 Report Share Posted July 14, 2009 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. Quote Link to comment
Minh Pham Posted July 20, 2009 Report Share Posted July 20, 2009 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 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? Quote Link to comment
Xploit Posted July 30, 2009 Author Report Share Posted July 30, 2009 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.