Connection parameters
Event-to-action and event-to-script connections sometimes require parameters (or arguments). The action's parameters are available as attributes of the connection. Therefore, to specify a parameter you simply make a connection to the parameter attribute of the event-to-action connection itself.
When a connection requires parameters that have not been specified, it appears as a dashed line, indicating that the connection is not complete.
In the To-Do List application, you connected the Push Button part's clicked event to the Ordered Collection part's add: action, and a dashed line resulted:
Add Connection
Note:
Actions that require parameters are typically indicated by a colon (:) in the action name. For example, the add: action takes one parameter. An action named add:after: takes two parameters.
Once you have specified all the necessary parameters, the connection line becomes solid, indicating the connection is complete. If you do not supply enough parameters for a connection, the connection continues to appear as a dashed line.
To specify parameters you can use attributes or constants.
Attributes as parameters
Most of the time, the parameters you need are attributes of other parts you are working with in the Composition Editor. To use a part's attribute as a parameter:
1. Make a new connection using the part's attribute as the source.
2. For the target, click mouse button 1 on the connection line that requires the parameter, and then from its connection menu, select the particular parameter attribute you are specifying.
While making a connection to a connection line, you will see a small visual cue in the middle of the connection line when the mouse pointer is directly over the connection line, indicating the pointer is positioned correctly.
Visual cue to show pointer is positioned correctly
In the To-Do List application, the object entered in the Text part is used as the parameter of the event-to-action connection between the Add Push Button and the Ordered Collection part.
Add Connection
In this example, you provided the parameter of the event-to-action connection by making an attribute-to-attribute connection between the Text part's object attribute and the event-to-action connection's anObject attribute. The connection's anObject attribute is the name of the first and only parameter of the add: action.
Constants as parameters
Parameter values can also be constants. You specify a constant value for a parameter in the Properties window for the connection.
For example, to specify a constant value for the parameter for an event-to-action connection:
1. Double-click on the event-to-action connection.
The Event-to-action connection Properties window opens:
Event to Action Settings
2. In this window, select Set parameters. The Constant Parameter Value Settings window opens:
constant parameter value setting
3. In the Constant Parameter Value Settings window, type the constant values for the parameters you want to add.
4. When you are done, select OK, and then select OK in the Event-to-action connection settings window.
Last modified date: 03/26/2020