Colouring words

Mike Bonner bonnmike at gmail.com
Mon Aug 10 13:59:51 EDT 2015


It sounds like you might want to look at the styledtext.  Its a bit
convoluted, but once you get it figured out, it should be very fast.

Pseudo code for this would be..
put the text of the field into a variable.
repeat for each line (paragraph) and build up an array of "runs" with
descriptive text styling for each paragraph.
Apply the resulting array to the field.

Sounds simple.. Isn't.


On Mon, Aug 10, 2015 at 11:40 AM, Michael Doub <mikedoub at gmail.com> wrote:

> Yet another approach:
>
>    put "this is the only  one" into fld 1
>
>    put empty into s1
>    put empty into e1
>    get MatchChunk (line 1of  fld 1,"(?i).+(only).+",s1,e1)
> -- the regexp capture returns the start and end characters the match
>
>    set the textcolor of char s1 to e1 of line 1 of fld 1 to red
>
> On 8/10/15 12:03 PM, Mike Bonner wrote:
>
>> You can do this..  Still a bit ugly but it works.
>>
>> set the textcolor of trueword ( truewordoffset("only",line 5 of field 1))
>> of line 5 of field 1 to red
>>
>>
>> On Mon, Aug 10, 2015 at 9:13 AM, Richmond <richmondmathewson at gmail.com>
>> wrote:
>>
>> On 10/08/15 16:51, dunbarx at aol.com wrote:
>>>
>>> @Mark
>>>>
>>>>
>>>> There is nothing wrong with setting the textColor of an entire line. Any
>>>> valid chunk expression would do.
>>>>
>>>> No, there is nothing wrong with that, but that is not what I want to do.
>>>
>>> Richmond.
>>>
>>>
>>> @, Richmond:
>>>>
>>>>
>>>> What are you seeing? Why does it not work? I am in v 6.7.
>>>>
>>>>
>>>> Craig Newman
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list