Groups in the message path: Trapping Mouseup
ambassador at fourthworld.com
Mon Dec 9 20:43:00 EST 2019
Mark Wieder wrote:
> The syntax for describing the message path gets
> pretty gnarly.
It gets somewhat simpler when we consider the origins of the object
model, though admittedly this is help more for us ol' timers than
For newcomers I just don't mention backgrounds at all unless there's a
specific need for it, and as long as I do that the message path is
pretty easily learned,
HC didn't have groups, and its background was a layer that filled the
entire card. For what it was, its message path was reasonable
straightforward once you learned what the background layer is and how to
MC had groups, far more flexible than backgrounds, and their place in
the message path is consistent with everything else: starting at the
control, moving on to containers the control is within.
MC's groups were super-awesome for many of us HC fans who'd dreamed of
such a feature for years, BUT -
The MC object model had no background layer, so importing HC stacks
would be a non-starter.
So Dr. Raney adapted the group object so that it could also serve the
role of an HC background. Once a group is made sharable, it acts like
an HC group.
Sounds good, but -
It's counter to the rest of the MC object model's message path.
So, after MC became LC, Mark Waddingham explored ways to both retain the
compatibility with HC while respecting that LC is inherently a different
model, and split the way shared groups are handled into two properties:
sharedBehavior: allows a group to be automatically copied to new cards,
retaining the simplicity of the object model in the message path, in
which messages flow from the control through its containers in visual
order (group then card then stack).
backgroundBehavior: emulates HC by altering the position of the object
in the message path per HC's convention for backgrounds (card then
background then stack).
As long as we think of backgroundBehavior as a sort of HC compatibility
mechanism, distinguishing its affect on the message path becomes easier.
For newcomers, I don't even mention backgroundBehavior at all,
introducing them only to sharedBehavior. With this orientation I find
they enjoy the benefits of shared groups and they never get confused.
Fourth World Systems
More information about the use-livecode