workaround for cut-off text in native scroller?

Ralph DiMola rdimola at evergreeninfo.net
Wed Jun 2 15:38:14 EDT 2021


native scroller?
I add 20 to the bottom of the "contentrect". This has worked fine for me in various apps. Your mileage may vary.

On resizing... JLM answered me on my "LiveCode day 1(4.x)" use list request and informed me that I have to roll my own so I spent the next 2-3 months making a general use resizing library that has worked well for me though the years. I have never used the newer built in options. The nice thing is that my library is handy for the very few desktop apps I have made.

Notes on below:
1. NEVER lock message just to handle resizing.
True true. This can get you into real trouble.

2. ALWAYS (and I mean always) set the lockLoc of a group.
True again with a caveat. If your creating a group by script you have to add one control in the group before you set the group's lockloc then rect of the group. Then you can start placing other controls in the group and it will not change size/position.

3a. Always resize/reposition things by setting their rect (not their top/left/width/...).
The rules I have gleaned is.
 a) Yes, the rect is always absolute.
 b) For best performance set the control's rect ONCE.
 c) Set the height/width before top/left/bottom/right if using the top/left/width/height. This is slow because the engine has to rerender after every size/pos change.
 d) When changing the width/height with ONLY even or ONLY odd numbers the control will remain centered. But if you use odd and even numbers the it will walk to the left/top. If you for example set the width to 100 then 101 then 100 then 101. The control will walk left by 1 pixel for every 100/101 width setting change. I can see why LC is attempting to keep the control centered I guess but keeping the top/left constant whilst changing the height/width would produce more predictable results.


Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Alex Tweedly via use-livecode
Sent: Wednesday, June 02, 2021 7:43 AM
To: use-livecode at lists.runrev.com
Cc: Alex Tweedly
Subject: Re: workaround for cut-off text in native scroller?


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
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