On Aug 10, 2015, at 12:15 PM, Richmond wrote:
> On 10/08/15 19:03, Mike Bonner wrote:
>> oh. Assuming you're on a version of lc that supports truewords
>>
>>
>
> Mine all seem to support falsewords . . .
>
> Err, sorry, the mask slipped there a minute :/
>
> I see that version 7.0.5 supports
On 8/10/2015 12:39 PM, Richmond wrote:
but, because one cannot set the textColor of a word in a stringVariable
it is very slow with large texts because it has to work within the field.
That's why I usually use the html suggestion that Mark S. provided.
After getting the htmltext of the field,
I was going to suggest looking at styledText too, but it is kind of
tricky to insert a run within the array.
I think Richmond should look at some of the text routines in the
masterLibrary. There are several that might be interesting:
LineOffsets returns a list of lines that contain a strin
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
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 r
The thing that emerges from my question is that to colour a word or
phrase programmatically
in a textField is a fiddly business and it would be nice (??) if a
simpler way to do this were introduced.
This works very well:
on mouseUp
put 1 into VOCABLE
repeat until word VOCABLE in fld
LiveCode
Sent: Mon, Aug 10, 2015 7:40 am
Subject: Colouring words
what is wrong with this:
if line 5 of fld "WHAT" contains "only" then
set the textColor of "only" in line 5 of fld "WHAT" to red
end
if
???
I would like to set certain phrases in
On 10/08/15 19:03, Mike Bonner wrote:
oh. Assuming you're on a version of lc that supports truewords
Mine all seem to support falsewords . . .
Err, sorry, the mask slipped there a minute :/
I see that version 7.0.5 supports truewords, and that's good enough for me.
Thanks for that one.
Ri
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
wrote:
> On 10/08/15 16:51, dunb...@aol.com wrote:
>
>> @Mark
>>
>>
>> There is nothing wrong with s
oh. Assuming you're on a version of lc that supports truewords
On Mon, Aug 10, 2015 at 10:03 AM, 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
On 10/08/15 16:51, dunb...@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 no
, 2015 8:58 am
Subject: Re: Colouring words
On 10/08/15 14:45, Mark Schonewille wrote:
> Hi Richmond,
>
> It may not be
as easy as you think:
>
> repeat with x = 1 to number of words of line y of
fld "What"
> if word x of line y of fld "What" is "only
On 10/08/15 14:45, Mark Schonewille wrote:
Hi Richmond,
It may not be as easy as you think:
repeat with x = 1 to number of words of line y of fld "What"
if word x of line y of fld "What" is "only" then
set the textColor of word x of line y of fld "What" to red
end if
end repeat
or
put
Hi Richmond,
It may not be as easy as you think:
repeat with x = 1 to number of words of line y of fld "What"
if word x of line y of fld "What" is "only" then
set the textColor of word x of line y of fld "What" to red
end if
end repeat
or
put the htmlText of fld "What" into myText
repl
what is wrong with this:
if line 5 of fld "WHAT" contains "only" then
set the textColor of "only" in line 5 of fld "WHAT" to red
end if
???
I would like to set certain phrases in a sentence to a different
textColor to the other words . . .
. . . should be dead easy.
Richmo
15 matches
Mail list logo