Text colour and groups

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Text colour and groups

Post by jekyllandhyde » Wed Jan 15, 2014 8:04 pm

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

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Text colour and groups

Post by Klaus » Wed Jan 15, 2014 8:32 pm

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

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: Text colour and groups

Post by jekyllandhyde » Wed Jan 15, 2014 8:52 pm

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

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Text colour and groups

Post by Klaus » Wed Jan 15, 2014 8:58 pm

Hm, does this also happen with a fresh stack and some grouped fields?
Tested here and works as exspected!? Also in the simulator!

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: Text colour and groups

Post by jekyllandhyde » Wed Jan 15, 2014 9:06 pm

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?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Text colour and groups

Post by BvG » Thu Jan 16, 2014 4:48 pm

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
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Text colour and groups

Post by Klaus » Thu Jan 16, 2014 5:04 pm

Aha, great, but that is really not the problem here 8)

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Text colour and groups

Post by BvG » Thu Jan 16, 2014 5:19 pm

I'm pretty sure it is, what makes you think it's not a problem with text property inheritance?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Text colour and groups

Post by Klaus » Thu Jan 16, 2014 5:40 pm

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

jekyllandhyde
Posts: 92
Joined: Thu Feb 14, 2013 7:17 pm

Re: Text colour and groups

Post by jekyllandhyde » Fri Jan 17, 2014 1:59 am

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Text colour and groups

Post by jacque » Fri Jan 17, 2014 6:07 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply