Geometry Manager

Peter Haworth pete at lcsql.com
Fri Aug 31 20:28:18 EDT 2012


This is actually turning out to be a lot simpler than I thought.  I hadn't
realised the resizeStack message passed the old and new height and width of
the stack as parameters.

With that info, it's trivial to resize or reposition a control releative to
the stack coordinates by adding the difference between the new and old
stack dimension to the appropriate control dimension..  I've defined a
cprop for each control that tells me whether it is to be scaled or
repositioned in each dimension, then the resize handler goes through all
the controls in the stack searching for thos with the cprop and handling
them appropriately.  Even with live resizing set to true, there's no
noticeable delay to the screen update.

I'm sure I'm not doing everythjing the GM is capable of doing but it works
for what I need right now.  I'll also try Jacque's ratio idea.

Pete
lcSQL Software <http://www.lcsql.com>



On Fri, Aug 31, 2012 at 11:54 AM, J. Landman Gay
<jacque at hyperactivesw.com>wrote:

> For the most flexibility, use ratios when resizing. I usually figure out
> what the ratio is for a control in my original layout and then use that for
> the calcuation. I.e., if a field should be a third of the vertical size of
> the card, then the ratio is .33. Multiply the card height by .33 and put
> appropriate values into the other three points of the rectangle; then set
> the rect. It all depends on your layout. Sometimes the width will remain
> constant, sometimes not. Sometimes you always want the left at 0, sometimes
> not.
>
> Repositioning works similarly. You can either change the topleft, or the
> location, or some other point, or you can use a ratio to calculate the new
> position (one-third of the way from top, for example) and set the topleft
> to that. Or set the left to the left of another object, or use any other
> reference that should line up.
>
> I suppose that's vague enough to confuse. :)
>



More information about the use-livecode mailing list