Change Field Property in All Fields of a Stack

Richard Gaskin ambassador at fourthworld.com
Tue Jun 15 09:14:48 CDT 2010


Steven Axtell wrote:
 > Is there a command that will allow a field property (textfont,
 > for example) to be changed in all of the fields of a stack at
 > the same time?

Most visual attributes (textFont, textStyle, textSize, backgroundColor, 
foregroundColor, and others) are inherited using roughly the same chain 
as the message path: control, background (if present), card, stack, home.

If you set the desired properties to empty in the controls themselves, 
you can set them at the stack level and those controls will take on 
those appearances.

Tip:  to find the property settings for a control you can of course just 
get it from the control, e.g.:

   get the textFont of fld 1

But if you've set the property to empty and want to know what value is 
being inherited by it, you can use the "effective" keyword:

   get the effective textFont of fld 1

That will return the value of the property nearest the control which has 
a non-empty value, or the engine's default if nothing in the message 
path has been set.

For example, if your field's textFont is set to empty and your card has 
a textFont of "Lucida Grande", then using "the effective textFont" will 
return "Lucida Grande".  If the card's textFont is empty but the stack's 
textFont is "Ariel", it will return "Ariel".  If you later set the 
textFont of the control to "Trebuchet", it will return "Trebuchet" 
regardless of the value of any subsequent objects in the chain.

HTH -

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list