[Solved] Re: Looking for an idea to ....

Rolf Kocherhans rolf.kocherhans at id.uzh.ch
Wed Feb 24 10:43:43 EST 2010

I finally had time to try out all the suggestions i got to shrink text automatically
so that it fits into a field of a fixed with.

Saharas method (which is the same as Andre G. suggested) works
best for my purpose. I like the repeat loop which makes the font smaller
but only to a certain size :-)

I am very happy with this solution thanks Sarah and oll the others
for your help.


Here is the script again:

on mouseUp
  -- shrink font until it fits, down to a minimum of (original size minus 5 <- see at the repeat loop)
  set the textSize of fld "fldMailAddress" to 14
  put 14 into tStartSize
  repeat 5 times
     if the formattedWidth of fld "fldMailAddress" > the width of fld "fldMailAddress" then
        subtract 1 from tStartSize
        set the textSize of fld "fldMailAddress" to tStartSize
        exit repeat
     end if
  end repeat
  show fld "fldMailAddress"
end mouseUp

More information about the Use-livecode mailing list