Should "dispatch" be extended for timers?

dunbarx at aol.com dunbarx at aol.com
Wed Aug 27 00:18:05 EDT 2014


Hi.


"Send' can, er, send parameters as well as a command. In a button script:


on mouseUp
   send "putArg" && random(99) && random(99)  && "XYZ" to me in 5
end mouseUp


on putArg var
   put var
end putArg


You get pairs of random numbers and the text as well. All parameters come across as a batch.


Or you can separate in the usual way:
on mouseUp
   send "putArg" && random(99) & "," & any char of "ABCD" to me in 5
end mouseUp


on putArg var,var2
   put var2 --or the first one or both
end putArg


Craig



-----Original Message-----
From: Richard Gaskin <ambassador at fourthworld.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Aug 26, 2014 10:09 pm
Subject: Should "dispatch" be extended for timers?


I love "dispatch", and the more I use it the more I find "send" murky.

With "dispatch" params seem more natural to me:

    dispatch "somecommand" to tSomeObj with tArg2, tArg2

But with "send" it's less clear how params are handled - here's an 
example from the forums today:

   send clearVideo LayerAlpha, baseLayer, LayerGraphic, \
      LayerAudio to me in 700 milliseconds

Seems like a good guess as to how it should be used, but of course the 
compiler complains.

So given that "dispatch" is also faster, why not use it for everything, 
extending it with "in" to allow timers:

    dispatch "somecommand" to tSomeObj with tArg2, tArg2 in 2 secs

Is there some reason I've overlooked as to why "send" allows timers but 
"dispatch" doesn't?

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com

_______________________________________________
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