dispatch usage versus send

Thomas McGrath III mcgrath3 at mac.com
Fri Jul 26 12:44:02 EDT 2013


I am trying to figure out the 'correct' use of dispatch:

I first set up a lot of details in an iOS app on launch. I load some text files and populate some custom props for use throughout the app. After that I want to load the appropriate fields and other aspects of the app from those custom props BUT only if everything else loaded. I won't know what the data is so I can't check that, I can only tell wether or not something was loaded. I was trying to determine if I should use send or dispatch.

I am using this code now:

on openstack
loadCustomPropsFromFile
dispatch "loadAllUsers" to card "Users" of this stack
     if it is "handled" then
          dispatch "loadCurrentUser" to card "Users" of this stack
          if it is "handled" then
               dispatch "loadCurrentUserForm" to card "Users" of this stack
          end if
     end if
end openstack

But I could use:

send "loadAllUsers" to card "Users" of this stack
send "loadCurrentUser" to card "Users" of this stack
send "loadCurrentUserForm" to card "Users" of this stack


My question is "Is the right usage of dispatch?" 
"Is there another 'better' way to accomplish this?"

Thanks

Tom

-- Tom McGrath III
http://lazyriver.on-rev.com
mcgrath3 at mac.com




More information about the use-livecode mailing list