hiliting all instances of a string in a field
Trevor DeVore
lists at mangomultimedia.com
Wed Mar 3 18:44:24 EST 2004
On Mar 3, 2004, at 3:05 PM, Dar Scott wrote:
>
> You can get the text not the htmlText and go through that. Check the
> text properties of each one back in the field to see if it is a link.
> Do the highlighting thing (whatever you want), if it is not. (If you
> don't have access to the original field, use a temporary or hidden
> field.)
Duh, I forgot I could set the backgroundColor of the text in the field
without having to worry about the htmlText. This is what I came up
with:
put text of tTargetField into tText
put number of chars of pHiliteTerm - 1 into tLength
put 0 into tLastOffset
put offset (pHiliteTerm, tText, tLastOffset) into tOffset
repeat while tOffset <> 0
set backgroundColor of char (tLastOffset + tOffset) to (tLastOffset +
tOffset + tLength) of tTargetField to "yellow"
put tLastOffset + tOffset into tLastOffset
put offset (pHiliteTerm, tText, tLastOffset) into tOffset
end repeat
Thanks,
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
More information about the use-livecode
mailing list