Send
Purpose
To send a message to an object.
Syntax
send
message
[of
object
]
arguments
What It Does
The send command is used to tell an object to perform the operation of the passed message. Message may be a message defined in a class or in the program. The makeup of arguments depends on the syntax of the message being sent.
The optional of object clause permits identification by name or access method of an object to receive the message. If the clause is not used, message is sent to the current object (self, i.e., the object that sent the message).
The following two samples are the same. In both cases, the message Request_Save is sent to the object Customer_DD.
Send Request_Save of Customer_DD
Handle hCustomer_DD
Move Customer_DD to hCustomer_DD
Send Request_Save of hCustomer_DD
The following two samples are the same. In both cases, the message AddNewName is sent to itself, passing three string parameters.
Send AddNewName sFirstName sLastName sPhone
Send AddNewName of self sFirstName sLastName sPhone
Internally, the message created by the send command is of the form msg_message. Send commands do not return a value to the sending object, as the get and set commands do.
If no definition of message can be found, the send command will generate an error at the end of compilation. If message is defined in the program but the receiving object does not understand the message, then an error will be generated at runtime.
Notes
- Previous versions of DataFlex used the
Tokeyword instead of theOfkeyword to specify the object that receives the message. This created confusion because theGetandSetcommands used theTokeyword for an entirely different purpose. TheTosyntax is still supported, and you will see it used in legacy DataFlex code.