change a locked group's rect without moving contained controls

Chris Sheffield cmsheffield at me.com
Fri Mar 9 17:33:51 EST 2012


Well, I had a feeling I'd find a solution as soon as I posted my message. :-)

Maybe there's a better way, but I finally realized I just need to temporarily store the starting location of each control in the group. Then I resize the group as needed, then follow that with resizing/repositioning the controls inside the group, using the saved starting location as a reference. Works like a charm.



On Mar 9, 2012, at 2:44 PM, Chris Sheffield wrote:

> Does that make sense? I've been working at this for a while now and can't figure it out. The answer is probably simple.
> 
> I have a grouped control that I'm trying to reposition at run-time. The group's lockLocation is set to true. The controls contained in the group are positioned first. So all I need to do is change the group's dimensions so none of the controls are cut off. I've tried different combinations of changing the group's width/height. I've tried changing the rect. I've tried changing the boundingRect. The last works the best, except it doesn't also change the rect to match, so even though the bounding rect is correct, the group's *visible* rect is not. And everything else I've tried moves the entire group, including it's controls, which have already been move. Not sure if I'm even making any sense.
> 
> What I'm ultimately trying to do is create a handler to resize controls at run-time when run on a mobile device. In this case, I'm currently mostly concerned with iPad (generations 1 and 2) vs. the new iPad. On the new iPad, I need everything to scale up to the higher resolution. My script works well so far, except in the case of a group with it's lockLocation set to true.
> 
> Jacque, if you're reading this, have you had any similar problems in your apps? I ask you because I know you've written code to do this kind of thing. :-)
> 
> Thanks,
> Chris
> 
> --
> Chris Sheffield
> Read Naturally, Inc.
> www.readnaturally.com
> 
> 
> _______________________________________________
> 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