Fit Content from a script
Glen Bojsza
gbojsza at gmail.com
Thu May 26 19:07:41 EDT 2005
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)
On 5/26/05, Jeanne A. E. DeVoto <revolution at jaedworks.com> wrote:
> 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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list