Colouring words

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Aug 10 07:45:03 EDT 2015


Hi Richmond,

It may not be as easy as you think:

repeat with x = 1 to number of words of line y of fld "What"
   if word x of line y of fld "What" is "only" then
     set the textColor of word x of line y of fld "What" to red
   end if
end repeat

or

put the htmlText of fld "What" into myText
replace "only" with "<font color=" & quote & \
   "red" & quote & ">only</font" in myText
set the htmlText of fld "What" to myText

Both approaches have advantages and disadvantages.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 8/10/2015 13:39, Richmond wrote:
> what is wrong with this:
>
> if line 5 of fld "WHAT" contains "only" then
>           set the textColor of "only" in line 5 of fld "WHAT" to red
>           end if
>
> ???
>
> I would like to set certain phrases in a sentence to a different
> textColor to the other words . . .
>
> . . . should be dead easy.
>
> Richmond.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list