formattedWidth

Scott Rossi scott at tactilemedia.com
Thu Jul 10 13:35:47 EDT 2014


I'm still not quite clear on what you're trying to accomplish.  If you
want to size a stack to the rect of all visible elements on a card, you
need to check the extents of those objects -- the right-most and
bottom-most edges -- not the space they occupy with formattedWidth or
height.

If I understand what you're looking to do, loop through your card objects,
grab the greatest right and bottom extents, and that should give you the
dimensions to use for your stack.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 7/10/14 10:07 AM, "Peter Haworth" <pete at lcsql.com> wrote:

>I recently posted about how to adjust the size of different cards within a
>stack and part of the solution I tried was using the formattedWidth and
>formattedHeight properties (actually the effective versions of them).
>
>I'm now seeing that the formattedWidth (and probably formattedHeight)
>return very unexpected values.
>
>The dictionary says it returns the width of a rectangle that contains all
>objects in the card whose visible property is true but I'm not seeing
>that.
>
>Make yourself a stack with a field on it with it's left edge in the middle
>of the stack and it's right edge somewhere off the right edge of the
>stack.
>
>Put a button on the card with the following code:
>
>get the rectangle of this stack
>put item 1 of it + the formattedWidth of this card into item 3 of it
>set the rectangle of this stack to it
>
>When you click the button, the stack will resize to the width of the
>field,
>in other words, the right edge of the field will still be off the right
>edge of the stack.  The only way this works correctly is if the field's
>left edge is at the left edge of the stack.
>
>I'm sure this is way formattedWIdth has always worked so it's not likely
>to
>be changed but it seems to be a not very useful implementation to me.
>
>Is there some other property that can be used to set the width of a stack
>to something that really does include all the objects on it?
>
>Pete
>lcSQL Software <http://www.lcsql.com>
>Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
>SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
>_______________________________________________
>use-livecode mailing list
>use-livecode at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list