Colouring words

Richmond richmondmathewson at gmail.com
Mon Aug 10 13:39:13 EDT 2015


The thing that emerges from my question is that to colour a word or 
phrase programmatically
in a textField is a fiddly business and it would be nice (??????) if a 
simpler way to do this were introduced.

This works very well:

on mouseUp
    put 1 into VOCABLE
    repeat until word VOCABLE in fld "TEKST" is "finalSolution666"
       put VOCABLE into fld "KOUNT"
       if word VOCABLE of fld "TEKST" is "the" then
          set the textColor of word VOCABLE of fld "TEKST" to red
       end if
       add 1 to VOCABLE
    end repeat
end mouseUp


but, because one cannot set the textColor of a word in a stringVariable
it is very slow with large texts because it has to work within the field.

Richmond.




More information about the use-livecode mailing list