Volunteer github guru for documentation submissions?
Mike Kerner
MikeKerner at roadrunner.com
Wed Apr 13 11:09:17 EDT 2016
Name: send
Type: command
Syntax: send <messageName> [ to <targetObject> [in <time> [seconds | ticks
| milliseconds]] ]
Summary: Sends <messageName> to <targetObject> immediately, or adds
<messageName> to the <pendingMessages><function> queue.
Introduced: 1.0
OS: mac,windows,linux,ios,android
Platforms: desktop,server,web,mobile
Example:
send "mouseDown" to button "next"
Example:
send "mouseDown" to button "text" of stack "project2"
Example:
# A simple timer using send example
local sTime
on mouseUp
put 0 into sTime
send "timerIncrement" to me in 1 seconds
end mouseUp
on timerIncrement
add 1 to sTime
put sTime
send "timerIncrement" to me in 1 seconds
end timerIncrement
Parameters:
message: An expression that evaluates to a message name, possibly including
parameters.
object: Any object reference. If you don't specify an object, the message
is set to the object whose <handler> contains the send command. If you
specify a time, you must also specify an object.
time (integer): If you don't specify a unit of time, the default of ticks
is used.
The result: If you specify a <time>, <the result> is the ID of the
<message> in the <pendingMessages> <function> queue.
Description:
Use the <send> <command> to override the normal <message path>, or to delay
a <command> until after a specified time.
The <messageName> can be either the name of a <handler> or a <LiveCode>
<statement>. If the <messageName> is a <literal string> containing more
than one <word> (for example, if it includes <parameter|parameters>, or if
it is a multi-word command), it must be enclosed in <double quote|double
quotes>.
Any parameters are evaluated before they are passed to the <send>
<command>. For example, the following statement sends the <mouseUp>
<messageName> with 2 as the first parameter:
send "mouseUp 1+1" to button "Example"
>*Important:* When the send command is used, the stack containing the
target <handler> temporarily becomes the defaultStack. All object
references in the <messageName> are <evaluate|evaluated> in the current
context i. e. the defaultStack. Therefore references within the message
that refer to "this card" or "this stack" will be referring to the card or
stack where the target <handler> is located.
>*Important:* If you don't specify a <time>, the <messageName> is sent
immediately, and any <handler> it <trigger|triggers> is completed before
the rest of the current <handler> is <execute|executed>. However, if you
specify a <time>, even one of 0, the current <handler> finishes
<execute|executing> before the <messageName> is sent.
>*Note:* Using the <send> <command> is slower than directly
<execute|executing> the <command|commands> using the normal <message path>.
For best efficiency, use the <send> <command> only when you want to delay
the <messageName> or when the <handler> you want to execute is not in the
<message path>.
References: callbacks (property), backgroundBehavior (property), function
(control_st), mouseUp (message), word (keyword), object (object), literal
string (glossary), return (glossary), evaluate (glossary), execute
(glossary), command (glossary), LiveCode (glossary), double quote
(glossary), trigger (glossary), message path (glossary), message
(glossary), parameter (glossary), statement (glossary), <handler>
(glossary), debugDo (command), dispatch (command), call (command), cancel
(command), result (function), pendingMessages (function)
More information about the use-livecode
mailing list