Geometry Manager
Bob Sneidar
bobs at twft.com
Tue Sep 4 11:45:47 EDT 2012
Someone had mentioned before that it will be important to record the baseline sizes of your controls and original stack size in a prop somewhere so you can use that in your calculations as opposed to the old size every time. Otherwise you will run into rounding errors, depending on your application and method of course.
Bob
On Aug 31, 2012, at 5:28 PM, Peter Haworth wrote:
> 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. :)
>>
> _______________________________________________
> 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