Set Text Size is empty but then not empty

Ken Ray kray at sonsothunder.com
Sun Jan 8 01:43:26 EST 2006


On 1/7/06 10:16 PM, "Sivakatirswami" <katir at hindu.org> wrote:

> I use this script to attempt to change the font sizes:
> 
> A menu button simply passes an integer between 10 and 24 to "tSize"
> 
> on setFontSize tSize
>    put "tamil,exact,edited,flat" into tFlds
>    repeat for each item da in tFlds
>      set the textsize of fld da to empty
>      set the textsize of fld da to tSize
>      set the textsize of fld (da&"_Title") to tSize
>       set the textsize of fld (da&"_Line") to tSize
>    end repeat
> end setFontSize
> 
> but the font sizes are not changing. The Textheight *does* change and
> reflects the new size issued from the menupick but the text in the
> field does not change...
> 
> Now... if I select the text of the fld and use this from another button:
> 
> on mouseUp
>      set the textsize of the selectedtext to  empty
> end mouseUp
> 
> The text in the field suddenly takes the size value I just set from
> the previous attempt.

Believe it or not, this is "normal" behavior. :-)

Let me explain... Remember that there is an inheritance chain for stuff in
Rev - if you don't set the card's backgroundcolor, but you *do* set the
stack's backgroundColor, all the cards in the stack will inherit the
backgroundColor unless a specific card has its backgroundColor set (in which
case the card's color takes precedence over the stack's color).

What you have here is the same thing, but in this order of inheritance:

  Selected Text -> Field -> Card -> Stack

So if you select text and change the text attributes of that text, it
doesn't matter that you later come along and change the attributes of the
field... the text will retain it's previously set text attributes and *not*
inherit from the field. However, if you clear out the text attributes of the
text by selecting it all and setting the textSize to empty (as you have
done), you now allow normal inheritance to continue, and the textSize can
now be inherited from the field itself.

Tricky, but it's still "normal" behavior....

;-)


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




More information about the use-livecode mailing list