TextStyle Inheritance

Ken Ray kray at sonsothunder.com
Sat Nov 22 10:46:35 EST 2003

> Does the current behavior means that it is not possible to do:
>   set the textSize of fld 1 to 24
>   set the textFont of fld 1 to monaco
> to set the size and font to 24/monaco because:

No, that would work just fine. The issue is one of inheritance. For
example, if you have a field that has no text attributes set for it, it
inherits its attributes from its parent. As soon as you apply one of the
three text attributes (font, size or style) to the field, it *breaks*
the inheritance from its parent, and the other two remaining properties
that you *didn't* set are *copied* from the parent into the field. So if
later on, you change the parent, the child doesn't get updated.


- Create a field on a card
- Set the text attributes of the *card* to Times New Roman, 14, plain
- Note that the field now displays in Times New Roman, 14, plain due to
- Set the textStyle of the *field* to bold
- Set the textFont of the *card* to Monaco
- Note that the field still displays in Times New Roman, 14, bold

This is because when the style of the field was set to bold, the font
and size (Times New Roman 14) were copied into the field, and the
inheritance connection was broken. So when you change the textFont of
the card to Monaco, the field doesn't inherit it anymore.

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

More information about the Use-livecode mailing list