Fit Content from a script

Jeanne A. E. DeVoto revolution at jaedworks.com
Fri May 27 15:58:15 EDT 2005


At 7:07 PM -0400 5/26/05, Glen Bojsza wrote:
>Thanks, it works but now I am trying to adjust the height as well
>because of how the fld gets set (I thought you could set the rect of a
>fld without its height or width changing?
>
>I have an image and a field.
>
>I want to have the field position below the image via script so:
>
>set the loc of fld "Site" to the loc of image "Tower" -- centers both objects
>put the rect of fld "Site" into tnewPoints
>put item 4 of the rect of the image Tower into item 2 of tnewPoints
>set the rect of fld "Site" to tnewPoints -- this causes the height of
>the fld Site to shrink to 1??
>set the height of the fld "Site" to the formattedheight of fld "Site"
>-- which still isn't perfect in postion
>set the width of fld "Site" to the formattedwidth of fld "Site" --
>this works since the rect info on width hasn't changed
>
>Is there a better way? How can you script  the Distribute command -
>edge to edge (this is in essence of what I am trying to accomplish)

I'm not completely sure how you want the positions to end up. 
However, for this I think the key is to finish changing the widths 
and heights before you start changing positions. (Changing the width 
or height of the field will change the position of its edges, so this 
needs to be finished first.) Try something like this:

   set the width of field "Site" to the formattedWidth of field "Site"
   set the height of field "Site" to the formattedWidth of field "Site"
   set the loc of field "Site" to the loc of image "Tower"
   set the top of field "Site" to the bottom of image "Tower"
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com


More information about the use-livecode mailing list