Dispatch

Bob Sneidar bobsneidar at iotecdigital.com
Wed Aug 3 11:23:20 EDT 2022


Send allows you to send in time. However the command or function must exist or you will throw an error. Dispatch cannot use send in time, but if a handler does not exist in the message path of the object you dispatch to, no error will be thrown. 

This can come in handy. Let's say you have assigned a behavior in all your fields, but in a few of your fields you have a special handler called Cleanup. You can then, 'dispatch "cleanup" to me' in any handler in the behavior. The fields that have the cleanup handler will get the message. The ones that don't will not throw an error. 

Bob S


> On Aug 3, 2022, at 07:30 , Craig Newman via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>> On Aug 3, 2022, at 9:36 AM, Sean Cole via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi all,
>> I've been thinking about the command 'dispatch'. Is there any
>> advantage/disadvantage in using it over just calling your handler?
>> Thanks
>> Sean




More information about the use-livecode mailing list