Error getting tags :
error 404Error getting tags :
error 404 send | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
send
Basics
Expander triangle
Type
Command
Syntax

send message [to object] [in time [seconds | ticks | milliseconds]]

Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Sends a message to an object.
Examples

send "mouseDown" to button "OK"
send "beep" to me in 20 seconds
send "goThere" && field "Where To" to stack "Destination" in 30

Additional Comments
Expander triangle

Use the send command to override the normal message path, or to delay a command until a specified time.

Parameters:

The message is an expression that evaluates to a message name, possibly including parameters.

The object is 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.

The time is an integer. If you don't specify a unit of time, the message is sent after time ticks.

Comments:

The message can be either the name of a handler or a Revolution statement. If the message is a literal string containing more than one word (for example, if it includes parameters, or if it is a multi-word command), it must be enclosed in double quotes.

Any parameters are evaluated before they are passed to the send command. For example, the following statement sends the mouseUp message with 2 as the first parameter:

send "mouseUp 1+1" to button "Example"

When the send command is used the stack containing the target handler temporarily becomes the defaultStack. All object references in the message are 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.

If you specify a time, the message is sent to the object after the specified time has elapsed. The message is added to the pendingMessages function. The ID of the message is returned by the result function. To cancel the message, use the cancel command with this ID.

Important! Specifying a time can affect the order in which statements are executed. If you don't specify a time, the message is sent immediately, and any handler it triggers is completed before the rest of the current handler is executed. If you use the send in time form of the sendcommand--even if you specify a time of zero seconds--the current handler finishes executing before the message is sent.

Note: Using the sendcommand is slower than directly executing the commands using the normal message path. For best efficiency, use the sendcommand only when you want to delay the message or when the handler you want to execute is not in the message path.

User Comments
Expander triangle
User thumbnail
Hans Behrens
StarStarStarStarStar
Apr 2, 2009
The 'send' command allows you to override the normal message path for handlers and custom commands. It cannot override the message path for functions. The 'value' command should be used to override the message path for functions.
Example:


put "amountOfLines(" & the id of field thisField of me & ")" into tEvaluationString
put value(tEvaluationString,stack "database") into tNumOfLines

User thumbnail
Paul Gabel
StarStarStarStarStar
Jun 7, 2009
The send command can be sent to hidden controls.
User thumbnail
Nicolas Cueto
StarStarStarStarStar
Aug 20, 2009
About "result".
Though explained in the Comments, the use of "result" after "send" is easy to overlook, so am adding an example for future reference.
Example:


send SomeMessage to me in 50 miliseconds
put the result into SomeMessageID
..
cancel SomeMessageID

User thumbnail
aloharo@gmail.com
StarStarStarStarStar
Jun 22, 2010
The send command allow allows ticks, milliseconds or seconds as the time parameter. However the compiler allows "send SomeMessage to me in 5 minutes" which is compiled as, I believe, 5 ticks.