Page 1 of 1

Text colour and groups

Posted: Wed Jan 15, 2014 8:04 pm
by jekyllandhyde
A simple question I'm sure, but it is perplexing me. I've hunted through documentation and forums but can't find an answer.

I have a button that I want to use to change text color in a bunch of fields.

I have grouped the text fields into a group called testgroup.

When I use the following command it changes the group's foreground colour but not the underlying field's text color?

set textcolor of group "testgroup" to "black"

I don't want to change the text color of each field individually?

thx, Adam

Re: Text colour and groups

Posted: Wed Jan 15, 2014 8:32 pm
by Klaus
Hi Adam,

are you sure that the fields in the group do not have their TEXTFONT property set?
And better set the "forecolor" of the group, a group does not have a "textcolor"! :D


Best

Klaus

Re: Text colour and groups

Posted: Wed Jan 15, 2014 8:52 pm
by jekyllandhyde
Klaus,

I thought forecolor was a synonym for textcolor (according to the livecode dictionary)? In any case I changed the command to use forecolor and still no difference.
I don't have any font assigned to the textfield when I examine it's properties?

Adam

Re: Text colour and groups

Posted: Wed Jan 15, 2014 8:58 pm
by Klaus
Hm, does this also happen with a fresh stack and some grouped fields?
Tested here and works as exspected!? Also in the simulator!

Re: Text colour and groups

Posted: Wed Jan 15, 2014 9:06 pm
by jekyllandhyde
Thanks for trying. I just created a brand new stack and tried it and yes it does work. Yikes, that means something in my project stack is interfering. How do I track that down? I am using the latest version of Livecode 6.5.1.
Could it be a bug or is it likely some kind of property of the text field is interfering?

Re: Text colour and groups

Posted: Thu Jan 16, 2014 4:48 pm
by BvG
Text styles are inherited from the field, the group it's in, the card they're on, and so on. So if you have set the textcolor (yes it's just a synonym), of the field, then it won't matter what the textcolor of the group is.

In addition single chunks of text also can have styles. For example if you select all the text in a field, and then you use the IDE menu to set it's color to red, you're basically doing this:

Code: Select all

set the textcolor of char 1 to -1 of field "example" to red
If that is the case, even the textColor of the field won't matter, nor anything higher 'up' the inheritance chain.

To remove the color from the characters in a field you'd best do something like this in the message box:

Code: Select all

set the textcolor of char 1 to -1 of field "example" to empty

Re: Text colour and groups

Posted: Thu Jan 16, 2014 5:04 pm
by Klaus
Aha, great, but that is really not the problem here 8)

Re: Text colour and groups

Posted: Thu Jan 16, 2014 5:19 pm
by BvG
I'm pretty sure it is, what makes you think it's not a problem with text property inheritance?

Re: Text colour and groups

Posted: Thu Jan 16, 2014 5:40 pm
by Klaus
As you might have read, we have already been through this. 8)

The fields in the group do NOT have their textfont property set,
so setting their OWNERs (group) forecolor should in fact work!

Adam is currently searching for any non-obvious possible property
inheritance or other, maybe script related problems.

You ARE searching, Adam, aren't you! :D

Re: Text colour and groups

Posted: Fri Jan 17, 2014 1:59 am
by jekyllandhyde
I gave up searching. It just doesn't work in my stack but it does in a fresh stack. I'm not technical enough to track this down. I found another option.
My overall goal was to create a button for night mode (red on black) of my screen for use in a rescue boat. Night vision is lost when viewing a white-ish light source. This I succeeded, so all is well.

Thanks for trying to help. And no, Klaus is right, no text font properties were set at all.

Adam

Re: Text colour and groups

Posted: Fri Jan 17, 2014 6:07 pm
by jacque
The field property may not be set but the text color of its individual characters may be. Try selecting all the text in the field and then use the Text menu to change the color to use the owners setting.

As BvG said, each character can have its own color, which will override the field setting. The only thing that can be causing the problem is an inheritance issue.