highlighting the foundText

Sarah Reichelt sarahr at genesearch.com.au
Sun Oct 10 21:43:44 EDT 2004


On 11 Oct 2004, at 10:33 am, Rich Lague wrote:

> I have a "find" field that finds the string in text file using the 
> offseItem command. The item that contains the search string is then 
> displayed in a field. I would like the search string to be highlighted 
> in the field after the find.
>
> I have tried using this script after I get everything into the field:
> -----------------------------------------------------------------------
> find thingToFind in field "card-name"
> set the highlight of the foundText to true
> -----------------------------------------
>
> The search string is in thingToFind. (I checked with the message box.) 
> But I can't make the text I'm look for highlight. What is a better way 
> to do this?
>
Try using offset to get the number of the first character in your 
thingToFind string. Then work out how long thingToFind is and select 
the chunk based on that.

e.g. (untested but should work)

put offset(thingToFind, fld "Found") into tStartChar
put the number of chars in thingToFind into tLen
select char tStartChar to tStartChar+tLen of fld "Found"

Cheers,
Sarah



More information about the use-livecode mailing list