formattedWidth

Peter Haworth pete at lcsql.com
Thu Jul 10 13:07:01 EDT 2014


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>



More information about the use-livecode mailing list