On 02/06/2021 04:18, Mark Wieder via use-livecode wrote:

I do ok on resizing routines until it comes to groups. Then I always end up reinventing things: when and where to lock messages, how to get things resized in the right order so as not to undo what I just did...

If there are any rules of thumb I'd love to know them.

I can tell you mine - they work for me , but whether they work for you, or anyone else, is a different matter.

1. NEVER lock message just to handle resizing.
      If you need to do that, you're already in a heap of trouble :-)

2. ALWAYS (and I mean always) set the lockLoc of a group.
    Don't let those uppity groups change their size - you need to be in charge :-)

3. Work top-down in a (fairly) strict hierarchy. Let each level of card/group handle the layout of its component pieces, allocate space for them and "set the rect .." for each.

3a. Always resize/reposition things by setting their rect (not their top/left/width/...).       Every time I try to use those seemingly-convenient shorter forms, I get in trouble :-)

4. Design in some logging mechanism so that if something is going wrong, you can easily turn on logging and see what is happening, across ALL your resizing group / controls.

5. In the very rare occasions where there is need to cross the hierarchy as above, do it explicitly (e.g. I have a convention of sometimes having a handler "presizecontrol" which returns a *preferred* size or minimum size, which the upper levels of the hierarchy can use to check what lower layer groups would like to be, can adjust their decisions accordingly - and then resize ("set the rect ..") accordingly.

Alex.



_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to