Colouring words

Mark Schonewille m.schonewille at
Mon Aug 10 13:45:03 CEST 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


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
KvK: 50277553

Installer Maker for LiveCode:

Buy my new book "Programming LiveCode for the Real Beginner"

LiveCode on Facebook:

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
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the use-livecode mailing list