text colors

Phil Davis revdev at pdslabs.net
Sat Aug 12 19:11:03 EDT 2006


Hi Liam,

Here's one way that works, using a button to make it happen. It uses the 
formattedText of the field to figure out which words are in which soft-wrapped 
lines. I'm sure there must be more elegant or robust ways to do it, but:

on mouseUp
   put the formattedText of fld "booking" into tText
   repeat with x = 1 to the number of lines in tText
     if "reservation" is among the words of line x of tText then
       put (the number of words in line 1 to (x-1) of tText) + 1 into tStart
       put (the number of words in line 1 to x of tText) into tEnd
       set the textColor of word tStart to tEnd of fld "booking" to "red"
     end if
   end repeat
end mouseUp

Best -
Phil Davis



Liam Lambert wrote:
> Hi all
> I want to change the color of a line in a fld if it contains the word 
> reservation
> something like this but this
> 
> REPEAT for each line tline in fld "booking"
>         IF line tline contains "reservation" then
>         set the colors of line tline to "red"
>           end if
>           end repeat
> 
> 
> Liam
> IRELAND
> liamlambert at mac.com
> 
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 



More information about the use-livecode mailing list