Should before [handler name] trigger when using send?

Paul Dupuis paul at researchware.com
Wed Mar 30 11:02:40 EDT 2016


On 3/30/2016 10:27 AM, Malte Pfaff-Brill wrote:
> Hi all,
>
> before I file a bug on this, I would like to enquire about your opinion.
>
> If in a behavior you have
>
> before resizeControl
>  — do some stuff
> end resizeControl
>
> should this trigger if you send resizeControl to the control from somewhere else?
>
> If yes, it does not seem to work in a standalone (but does not trigger an error in the IDE). In the standalone it throws a can’t find handler error…
>
> What would you expect to be the correct behavior in this case?

A tough question! I personally have rarely used before/after handlers,
but I do use send and dispatch frequently. My expectation when I execute
a send <message> to <object> is  that if there is a handler for
<message> in <object> then that message should execute as normal and if
there is NO handler for <message>, then <message> should be passed along
the message hierarchy as documented ending with the engine itself.

Based on that, I would expect that if there is a before OR after
<message> handler in <object> they should execute because they would if
the message was passed from above to <object> or generated for <object>
by a user event.

An argument could be made that a before handler SHOULD NOT execute, but
an after handler SHOULD since the message was sent directly to the
object (i.e. skipping the normal path and hence the before handler.




More information about the use-livecode mailing list