Error getting tags :
error 404Error getting tags :
error 404 target | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
target
Basics
Expander triangle
Type
Function
Syntax
the target target()
Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Returns the object which received the message that started execution.
Examples

the target
if word 1 of the target is "button" then clickedAButton
set the backgroundColor of the target to "black"

Additional Comments
Expander triangle

Use the target function within a message handler to determine which object originally received the message.

Value:

The target function returns the name property of the object.

Comments:

Suppose a card script contains a mouseDown handler. If the user clicks a button, a mouseDown message is sent to the button. If the button's script does not contain a mouseDown handler, the message is passed to the card, and handled by the card's mouseDown handler.

The target function is similar to the me keyword. In the example described above, within the card's handler, the target function returns the button's name, because the button is the object that first received the mouseDown message. However, the me keyword is a reference to the card, because the card is the object whose script contains the mouseDown handler that is executing.

User Comments
Expander triangle
User thumbnail
revonline@fourthworld.com
StarStarStarStarStar
Jun 2, 2010
Note that in v4.5 and earlier there is an exception to the way the target function works on comboBox controls: because a comboBox is comprised internally of two controls (a button and a field), using "me" will refer to the button but using "the target" will refer to the field. This anomaly isn't too hard to deal with once you're aware of it, and is explained a bit more by Mark Waddingham in the RQCC: http://quality.runrev.com/qacenter/show_bug.cgi?id=8653