Listen for messages in FrontScripts

Bob Sneidar bobs at twft.com
Tue Jan 3 16:08:58 EST 2012


On Jan 3, 2012, at 12:01 PM, Todd Geist wrote:

> Send is different because messages not handled but the target DO NOT
> continue down the message path.  Send does NOT resolve "me" to the behavior
> script if there is any. Like Dispatch the context is the receiving object,
> not the sending one.

I am not sure this is exactly true. I have a behavior for all my database forms, so that I can code generally for all forms, while also putting form specific code in the actual card script. It is my recollection that if I send to the card, and the card does not handle the message, or passes the message, then the behavior script gets it. 

To test this, I scripted a handler in the stack script which popped an answer dialog. I then sent the handler to the current card, and the stack script got it. 

> I think dispatch does switch contexts.  It send the message to the object
> and it is processed along the normal message path.  It does have a special
> use of the "me" object which can refer to a behavior. But other than that I
> am pretty sure that references are evaluated in the context of the
> receiving object, not the sending one.

If that is the case, then you should submit a comment in the dictionary for dispatch. I looked and there does not seem to be any mention about switching contexts or having the target object's stack become the defaultStack. 

Bob







More information about the use-livecode mailing list