Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 26th Jan 2018 21:26 Edited at: 28th Jan 2018 14:56
I'm trying to use tags to color text inside a createtext item.
Not work as expected.
Could you help me ? Perhaps another logic ? The problem occur when i remove the tags (ReplaceString)

Here my code to try :



Note : i've edited my previous thread so you can now try the code on your computer.
Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Jan 2018 15:19
i'm trying another method 'split to word the sentence...
Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Jan 2018 15:34
Hi Hubert

I think the format tags make it hard so I quickly modified the example to do it a different way.

Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Jan 2018 15:55
Another version from my previous code : works only with tag </r> !



Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Jan 2018 15:58 Edited at: 28th Jan 2018 15:58
The problems is that your code ONLY works when it is is used one with one set of tags....if you try the code above to highlight multiple different sections you have a problem where the colour doesnt line up with where your tags were.

You shorten the text but the highlighted letters stay in the same place so it becomes incorrect. The method I showed works no matter how many different colours or sections of text etc....
Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Jan 2018 15:59
Thanks Bengismo. I'm testing another idea...
Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Jan 2018 16:02 Edited at: 28th Jan 2018 16:02
another tag system : Sentence = "Hello everybody <cFF0000>This is red text</c>, now <c00FF00>this is green text</c> and <c0000FF>finally blue</c>."
with my last code.
Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Jan 2018 16:18 Edited at: 28th Jan 2018 16:18
That should work ok as it will process the first tags before later tags in the string and so colour should stay aligned with the text. Very nice!
Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Jan 2018 16:26 Edited at: 28th Jan 2018 16:33
With red, blue,green color : hexa value like #FF0000


Hubert BAYRE
2
Years of Service
User Offline
Joined: 21st Oct 2017
Location: France
Posted: 28th Jan 2018 16:36
i can process before call the fonction. Replace <r> by #FF0000 and <b> by #0000FF

Many thanks for your help Bengismo.

Login to post a reply

Server time is: 2020-03-31 04:05:26
Your offset time is: 2020-03-31 04:05:26