This still isn't exactly what I want. Given search term of "http:" this will
change color of the entire word "http://somesite.com". I only want to change
the color of what matches. Tried the following:
on mouseUp
set the traversalOn of field "Results" to true
put the text of field Results into tResults
put the text of field "SearchField" into strSearch
put the length of strSearch into tLength
put 1 into tFramePos
put 0 into tPreviousOffset
repeat while tFramePos <> 0
put itemOffset(strSearch,tResults,tPreviousOffset) into tFramePos
select characters (tFramePos+tPreviousOffset) to
(tFramePos+tPreviousOffset+tLength) of field "Results"
set the textColor of the selection to red
set the BackgroundColor of the selection to yellow
put tFramePos + tPreviousOffset into tPreviousOffset
end repeat
end mouseUp
I get a syntax error on the "select characters" line. After consulting the
Dictionary/User Guide/web I can't find syntax how to select characters. Am I
specifying this wrong or is there another command to do this?
Thx,
John
On Nov 21, 2011, at 8:31 PM, Mike Bonner wrote:
> you can "set the textcolor of the selection to red"
>
> Be aware though, if you just have an insertion point in the field, and set
> the textcolor of the selection to red, any typing done afterwards will be
> red. If this isn't what you desire you'll probably want to check to see
> what is selected so you can avoid this behavior.
>
> On Mon, Nov 21, 2011 at 6:31 PM, John Brozycki <[email protected]> wrote:
>
>> Is it possible to select text in a field and change the text or highlight
>> color of JUST the selected text? I realize I could do this with HTML (
>> such as
>> <FONT COLOR="#000000">) but what if you are trying to highlight and
>> display HTML source, and thus the field is plaintext so that HTML commands
>> display instead of being rendered in the field?
>>
>> find string... - only provides a highlight box around sequential searches
>> for the text, and in the same color of the text.
>>
>> set the textColor of field x... - changes the color for the entire field.
>>
>> Any suggestions greatly appreciated!
>>
>> Thanks,
>> John
>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode