Send and Dispatch without parameters

Pete pete at mollysrevenge.com
Fri Jan 27 17:08:36 EST 2012


send/dispatch with no parms works fine for me.  Where are you sending the
message from - same card as the target, same stack, different stack?
 Shouldn't make any difference but if there is a problem, gonna need to
know the details.

Pete

On Fri, Jan 27, 2012 at 12: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
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list