Resizing a Text Field Dynamically, While Locking Its XY Coordinates
J. Landman Gay
jacque at hyperactivesw.com
Tue Jan 13 17:01:47 EST 2009
Ron Toledo wrote:
> Hello All,
>
> I'm new to Rev, and am attempting to create a paned interface on a stack.
Welcome!
>
> Specifically, I have two text fields, with a little grabber icon between
> them. The effect I'm trying to accomplish is that, as I drag the little
> grabber button between the two fields, the two fields on either side are to
> automatically resize in width.
>
> I'm experimenting with just the left text field and grabber icon at this
> time. My current challenge is that when I drag the grabber, the text field
> on the left resizes in width-- however, it resizes from its centerpoint
> outwards. Ideally, I would want the text field's XY coordinates to remain
> locked, while the right side of the text field resizes.
>
> Is there a property for Rev objects that can configure objects to resize
> from one specific side?
Yes, what you want is the "rectangle" property (commonly abbreviated
"rect"). Setting the width or height resizes the object equally on both
sides, as you found out. So instead, get the rect of the object, add or
subtract an amount from one of the sides, and reset the rect to the new
dimensions.
So if I wanted to add 10 pixels to the right side of a field, I'd do this:
put the rect of fld "testFld" into tRect
add 10 to item 3 of tRect -- item 3 is the right side
set the rect of fld "testFld" to tRect
See the "rectangle" property in the dictionary, which will tell you
which item corresponds to each side.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list