Set the color of a sigle word in a field

Frank D. Engel, Jr. fde101 at fjrhome.net
Mon Mar 14 10:34:59 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmm... There may be some serious issues with this code, but I wonder 
how hard it would be to get this working (untested):

on rawKeyUp
   put " " &field "blueWhile" & " " into field "blueWhile"
   put the htmlText of field "blueWhile" into bw
   replace " while " with " <font color=" & quote & "#0000ff" & quote & 
">while</font>" in bw
   set the htmlText of field "blueWhite" to bw
   delete char 1 of field "blueWhite"
   delete the last char of field "blueWhite"
end rawKeyUp

Anyone care to clean this up, limit coloration to the line the cursor 
is on (performance), etc.?


On Mar 14, 2005, at 8:39 AM, Mark Swindell wrote:

> I'm sure it's  not the best way, but here's one way to make it happen:
> What I'd like to know from anyone is what the syntax would be  for the 
> following using the "repeat for" structure rather than "repeat with x 
> = 1 to the number of..." structure.
>
> on rawkeyup
>   repeat with x = 1 to the number of words of field "blueWhile"
>     if word x of field "blueWhile" is "while" then
>       set the textcolor of word x of field "blueWhile" to blue
>       set the textcolor of the last word of field "blueWhile" to black 
> --resets black so ensuing words don't remain blue
>     end if
>   end repeat
> end rawkeyup
>
>
>
> On Mar 13, 2005, at 9:30 PM, Kevin J wrote:
>
>> Ok I was trying every thing that I could think of to get this to work.
>> I was reading all the docs to see if I could figure it out but its not
>> working. What I am trying to do is when someone types in the word
>> "while" into the field"txtWindow" it will set that word to the color
>> blue but all the other words will stay black. I can't figure it out
>> for the life of me. Is there something that I can download to look at
>> that as somthing almost the same?
>>
>> Thanks
>>
>> Kevin
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
- -----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCNa8j7aqtWrR9cZoRAplSAJwOCuQUvL4H5E8UcngK8TxpVDnf/ACeMyBh
RXberDCC6PHjA5+kBeeEB3s=
=+Gfp
-----END PGP SIGNATURE-----



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list