Page 1 of 1

foregroundColor of lines of a field?

Posted: Mon Apr 18, 2016 4:01 pm
by Zax
Hello,

I tried to set different foregroundColor of different lines of fld but only the last was well coloured.
I used this sample script :

Code: Select all

put "Blue,Black,Red" into colours
put "" into fld "MyField"
repeat with i = 1 to (the number of items in colours)
	get item i of colours
	put it into line i of fld "MyField"
	set the foregroundColor of line i of fld "MyField" to it
end repeat
Of course, I could do a second pass, in order to apply colours. Is it the only way to do what I want or I miss something?

Second pass:

Code: Select all

repeat with i = l to (the number of line in fld "MyField")
	set the foregroundColor of line l of fld "MyField" to (line l of fld "MyField")
end repeat
Thank you for you help.


Another thing, when I try to paste some text from a LC application in a text document, it only works if I didn't QUIT my LC application. Is it normal?
I'm using:

Code: Select all

set the clipboardData["text"] to "MyTest"

Re: foregroundColor of lines of a field?

Posted: Mon Apr 18, 2016 5:04 pm
by dunbarx
HI.

Your first handler works fine for me in v. 6.7. As it should. What are you seeing? No foreground color at all?

As for the clipboard, I have seen this intermittently. Sometimes I can reproduce it, sometimes not. Anyone else see this?

Craig Newman

Re: foregroundColor of lines of a field?

Posted: Wed Apr 20, 2016 10:07 am
by Zax
dunbarx wrote:Your first handler works fine for me in v. 6.7. As it should. What are you seeing? No foreground color at all?
For me, only the last line is coloured.

It seems the command:

Code: Select all

put it into line i of fld "MyField"
refreshes the field and so resets colours.

Re: foregroundColor of lines of a field?

Posted: Wed Apr 20, 2016 3:49 pm
by dunbarx
Hi.

This is very odd. Please forward your stack, the one where only the last line is colored, to QCC. Or post it here first, so I can test it. But what version of LC are you working in?

Craig

Re: foregroundColor of lines of a field?

Posted: Wed Apr 20, 2016 4:00 pm
by Klaus
put "Blue,Black,Red" into colours
put "" into fld "MyField"
repeat with i = 1 to (the number of items in colours)
get item i of colours
put it into line i of fld "MyField"
set the foregroundColor of line i of fld "MyField" to it
end repeat
Your script works as exspected in LC 8.0 RC1!

Re: foregroundColor of lines of a field?

Posted: Thu Apr 21, 2016 9:53 am
by Zax
This is a sample stack with the script, and a screnne capture of what happens when I run the script with LC 7.0.0
TestColours.livecode.zip
(1.39 KiB) Downloaded 210 times
TestColours_screen.jpg
TestColours_screen.jpg (24.75 KiB) Viewed 4667 times

Re: foregroundColor of lines of a field?

Posted: Thu Apr 21, 2016 11:49 am
by Klaus
The stack and script also work as exspected in LC 7.1.3!

However I would highly recommend to NOT use IT more often that neccessary,
since IT changes when you least exspect IT! :D

Re: foregroundColor of lines of a field?

Posted: Thu Apr 21, 2016 3:33 pm
by dunbarx
Might you be using v.8? If neither Klaus nor I can duplicate your problem in 6 or 7, I would suspect the version...

Craig

Re: foregroundColor of lines of a field?

Posted: Fri Apr 22, 2016 8:20 am
by Zax
Your conclusion seems right. Maybe there is a bug with the 7.0.0 version.

Anyway, thank you.