Change Field Property in All Fields of a Stack
Richard Gaskin
ambassador at fourthworld.com
Wed Jun 16 08:03:47 EDT 2010
René Micout wrote:
> YES, thank you Richard !
> I don't understand all that but (after experimentation > I keep your
> post preciously) I think I can bring improvement in my sripts...
> René
Thank you for the kind words, René. That I can help someone as
accomplished as yourself makes my day.
Rev's visual property inheritance is, AFAIK, unique among xTalks.
Because it's unique it's not obvious to folks coming from other
dialects, but IMO it's one of the finest examples of where the
unlearning Rev requires pays off big and demonstrates that Rev is truly
the rightful heir of the xTalk crown.
You said the most important word about learning any programming
language, a word so important it seems worth drawing attention to:
experimentation
I believe that's the key to learning most anything, and with programming
languages it's even better: failure happens only between you and a
machine where there is no embarrassment, and everything happens in
real-time so you can see outcomes immediately. You try, you see what
worked and what didn't, you revise, and try again. Each time you learn
something new, and when it's done you get that wonderful "a ha!" moment
when it all falls into place.
In that process many things happen: You learn new tokens, you learn the
old tokens more clearly, and you become an ever better typist (which may
seem an archaic skill but it remains so useful for writers of all types,
whether it's code for machines or words for people).
Phil Davis once shared with me an old quote which has become a favorite:
Good judgment comes from experience.
Experience comes from bad judgment.
:)
Experiment away! If you keep backups you can do no harm, and that
hands-on learning is among the most powerful things humans do.
--
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
>>> 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 -
More information about the use-livecode
mailing list