Send and Dispatch without parameters

Mike Bonner bonnmike at gmail.com
Fri Jan 27 16:39:43 EST 2012


I don't see this behavior when I try it. Updated win7, lc 5.0.2.  Not sure
why your results differ unless maybe theres a frontscript doing strange
things?

On Fri, Jan 27, 2012 at 1:54 PM, Bob Sneidar <bobs at twft.com> wrote:

> Hi all.
>
> I just noticed that if you send or dispatch to an object and you have
> specified parameters in the objects handler, but you don't provide the
> parameters when you send or dispatch, the call will silently fail. This
> seems only to occur for built in handlers, like mouseUp for example.
>
> If I have a button called "myButton" with a mouseUp handler:
>
> on mouseUp pButtonNum
>    put "This is a test"
> end mouseUp
>
> if I:
> send "mouseUp" to button "myButton"
>
> or:
> dispatch "mouseUp" to button "myButton"
>
> The button will never get the message, and no error is generated. This
> caught me quiet off guard, as you can for a custom handler just call it,
> and even if you don't provide all the parameters, the handler gets called
> anyway.
>
> However, if I have a custom handler:
>
> on testMe theMessage
>    put "This is a successful test."
> end testMe
>
> And then I send or dispatch without the parameter, the handler gets called
> fine! Is this normal or expected behavior? I cannot think that this kind of
> ambiguity is what the devs intended. If someone can give me a reason for
> why it has to be this way, I can just watch for it in the future. If not I
> suppose I should submit a bug report.
>
> In the meantime, I suppose the best practice is to never put the business
> end of your code in the built in handlers, but rather call a command or
> function that does all the work. That way you can send or dispatch to that
> handler and not to the built in one.
>
> Bob
>
>
>
> _______________________________________________
> 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