Changing Properties of All Fields in a Group
kray at sonsothunder.com
Mon Jun 2 11:18:34 CDT 2008
> Is there a command that allows one to change a property setting for all of the
> fields in a group? For example, I want to change the textColor property of
> all of the fields in a group to a given color. Rather than have a line of
> code for each field, I imagine that there is a command that will allow all of
> the fields to be changed in one line of code. I've tried to search for
> possible keywords but haven't identified anything yet.
The answer is "yes", and "sort of". Rev uses an inheritance model for
properties, so if you set a property of an object to empty, it will inherit
the property setting from its container.
So in order to do this, you'd need to have all the fields in the group have
*no* textColor, and then set the textColor of the group. However keep in
mind that this will affect the group itself as well, so if you're showing
the name of the group as well, it will also change to the same textColor.
You can test this in a sample stack by dragging out two fields, set their
contents (but *not* their text color), grouping them, and then setting the
foreground color of the group to red - you'll see the text in the fields
If you've already assigned text colors to a field, you can empty it out and
inherit from its container by clicking the "clear" button in the Inspector
palette next to "Text".
One final thing - if you need to find out in script what text color is in
use in the field, you can't just do:
put the textColor of <fieldDescriptor> into tMyVar
because this will set tMyVar to empty (""). In order to find out what it
inherited, you need to use the "effective" keyword:
put the effective textColor of <fieldDescriptor> into tMyVar
Of course, if you can't use inheritance in your specific instance, there is
no single way to set the textColor for multiple fields; you'd need to use a
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode