Fit Content from a script

Jeanne A. E. DeVoto revolution at jaedworks.com
Thu May 26 18:25:30 EDT 2005


At 5:42 PM -0400 5/26/05, Glen Bojsza wrote:
>I have several fields that get created from a script and I want to
>also have the fields size from a script  the same way as "Fit Content"
>works the size and position menu.
>
>There is no "Fit Content" command so is there another way to script this?

Like this:

   set the height of field "Whatever" to the formattedHeight of field "Whatever"

You'll probably want to check whether the field is empty and whether 
its formattedHeight is larger than the card's height.

If the field is a single line and shouldn't wrap, you'll want to set 
its width. The best way is to set its width to a maximum and then set 
it to the formattedWidth:

   set the width of field "Whatever" to the width of this stack
   set the width of field "Whatever" to the formattedWidth of field 
"Whatever" -- shrinks if necessary

This is because the formattedWidth takes word-wrap into account.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com


More information about the use-livecode mailing list