Change Text Colour of Group

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Change Text Colour of Group

Post by hrcap »

Hi All

I have two radio buttons:

- England
- Australia

These are grouped into a group titled "group_countries"

I would like to be able to set the text colour of the group but can't work out how to do this, I have tried:


set the textcolor of group "group_countries" to 0, 0, 0


does anybody know how to achieve this?

Many Thanks
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10105
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Change Text Colour of Group

Post by FourthWorld »

TextColor used for inline text in fields. For control labels try the foregroundColor.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: Change Text Colour of Group

Post by hrcap »

Hi Richard

Thank you very much for the input, I have tried this but unfortunately still no luck, I think the issue is more focussed around how to get the text colour of the radio buttons to change as a group.

For example if I use the following on an individual button it works

set the textcolor of me to 0, 0, 0


Whereas using the following to try to change the colour of all items in the group doesnt

set the textcolor of group "group_countries" to 0, 0, 0


(a little bit difficult to explain clearly)


Many Thanks
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Change Text Colour of Group

Post by bogs »

I think what your looking for is something like this :

Code: Select all

repeat with x=1 to the number of controls of group "rdoButtons"
set the foregroundColor of control x to "purple"
end repeat
The above assumes you only have radio buttons in the group, but you can target specific controls more finely if needed.
Image
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Change Text Colour of Group

Post by Klaus »

Hi all,

groups do not have a "textcolor" property, you mean the "foegroundcolor".

Hint:
When setting this prop for the group all its children will in fact INHERIT this property, so all textcolor of all childrens will change!

UNLESS you already have set this property for some objects in the group manually (or by script) then this will overwrite the inheritance!


Best

Klaus
hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: Change Text Colour of Group

Post by hrcap »

Thanks all, the reason that is was not working is because I had already set the text size prior to establishing the script on the group, thus the group script did not take effect.

I started from scratch and the group script then worked.


Many Thanks
Post Reply