clipsToRect property (was Re: Instantiaing Grouped Controls - Templates - Responsive)
Mark Waddingham
mark at livecode.com
Wed Jun 14 03:20:11 EDT 2017
On 2017-06-14 02:18, Monte Goulding via use-livecode wrote:
> I think this is one of those cases where the default behaviour was a
> bad idea. Or perhaps was implemented before groups were used for much
> other than backgrounds. Other objects we need to set to the formatted
> width/height so why are groups special cased. Anyway, I would keep it
> simple and use `Clips to rect` so at least it’s easy to relate to the
> dictionary entry/property name.
Notionally 'backgrounds' don't really need an extent - they should be
card sized - the difference being that controls are shared amongst
several cards.
Of course MetaCard generalized 'the background' to multiple backgrounds
and then groups (which aren't backgrounds) - however, as this was done
'evolutionary', we've ended up with several properties for controlling
them which interact not-all-that-well.
If you step back and look at the types of 'group' thing which actually
get used, then there are probably only three main ones:
1) Card sized layers which are not shared amongst cards (foreground
groups, if you like)
2) Card sized layers which are shared amongst cards (background
groups, if you like)
3) Groups with an explicit rect which are not shared amongst cards
(control groups, if you like)
(Variants of these where the content rect is distinct from the visible
rect are also plausible - i.e. scrolling views).
Currently (1) and (2) are catered for because groups (by default) resize
to the size of their controls; 'clipsToRect' caters for (3).
I'd perhaps suggest that 'Clips to rect' or similar is a suitable name
for the property. Why? Because that is precisely what it does - all
children are clipped to the rect of the group, rather than the group's
rect being resized to accomodate them so they are not clipped.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list