Hiliting Words in a Field

Michael Kann mikekann at yahoo.com
Mon Jun 7 16:39:22 EDT 2010


Gregory,

A while back on the list there was much discussion of what constitutes a "word." To cover all your bases you have to concern yourself with punctuation and case. It's all there in gory detail. Here's some code that might help out a wee bit. I'm sure others on the forum can do it in one line, so you might want to wait for their input.

----------------------------
on mouseUp
put "Scotland is victorious" into fld 1
put "Scotland"into chosenWord
put "yellow" into chosenColor
put fld 1 into v
put zero into c
repeat for each word w in v 
add 1 to c
if w is chosenWord then
set the backgroundColor of word c of fld 1 to chosenColor
end if
end repeat
end mouseUp
----------------------------

--- On Mon, 6/7/10, Gregory Lypny <gregory.lypny at videotron.ca> wrote:

> From: Gregory Lypny <gregory.lypny at videotron.ca>
> Subject: Hiliting Words in a Field
> To: "Revolution" <use-revolution at lists.runrev.com>
> Date: Monday, June 7, 2010, 3:09 PM
> Hello everyone,
> 
> I have a data field with many lines and I'd like to script
> a handler that hilites every appearance of a particular word
> in yellow?
> 
> Regards,
> 
> Gregory
> _______________________________________________
> 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