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: 43
Joined: Mon Jan 14, 2019 5:20 pm

Change Text Colour of Group

Post by hrcap » Tue Apr 16, 2019 2:33 pm

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: 6720
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Change Text Colour of Group

Post by FourthWorld » Tue Apr 16, 2019 2:38 pm

TextColor used for inline text in fields. For control labels try the foregroundColor.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: Change Text Colour of Group

Post by hrcap » Tue Apr 16, 2019 2:47 pm

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: 3562
Joined: Sat Feb 25, 2017 10:45 pm

Re: Change Text Colour of Group

Post by bogs » Tue Apr 16, 2019 3:40 pm

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: 11062
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Change Text Colour of Group

Post by Klaus » Tue Apr 16, 2019 4:31 pm

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: 43
Joined: Mon Jan 14, 2019 5:20 pm

Re: Change Text Colour of Group

Post by hrcap » Tue Apr 16, 2019 5:58 pm

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

Return to “Getting Started with LiveCode - Complete Beginners”