Dispatch vs Libraries

Pete pete at mollysrevenge.com
Sun Nov 27 17:17:18 EST 2011


Hi Todd,
All interesting stuff.  I knew about the it and return values for dispatch
but thought the result only worked with functions, but makes sense that
what you're doing would work too.

On Sun, Nov 27, 2011 at 12:27 PM, Todd Geist <todd at geistinteractive.com>wrote:

> On Sun, Nov 27, 2011 at 10:41 AM, Pete <pete at mollysrevenge.com> wrote:
>
> Something looks a little strange about the first dispatch statement -
> > you're sending a message to an array? I thought messages went to
> > stacks/cards/controls.  I think you'd also need to use the "dispatch
> > function" syntax to get a result back.
>
>
> Hi Pete,
>
> It works. You don't need to use the function syntax unless of course it is
> a call to a Function that you are dispatching. In the case I cited I am
> using a command but the command uses Return to return the result.
>
> When you do it that way,  you get the returned value in "the result".  And
> "it" contains "handled", "unhandled", or "passed"
>
> And the arrayElement just contains the long id of the control that I am
> sending the message to. I set it like this
>
> put the long id of button "Contacts" into Services["Contacts"]
>
>
> Since Services is Global I can now dispatch a message to that Control from
> anywhere like so
>
> dispatch "Message" to Services["Contact"] with param1, param2, param3
>
>
> This seem very readable to me.
>
>
> Todd
>
>
> --
> Todd Geist
> geist interactive
> (805) 419-9382
> _______________________________________________
> 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