Parameter-from-action
Parameter-from-action connections use the result of an action as a parameter to a connection. This connection type can be used in very powerful ways. To illustrate the use of this connection, we'll introduce a new part called the
Object Factory. As the name implies, the Object Factory part creates new objects from an existing
model called a
Class. In this case, the mold we will use is the already familiar
Ordered Collection. If you remember, you used the Ordered Collection part to build the To-do List sample. Refer to
Working with nonvisual parts for the details related to the use of the Ordered Collection part in the To-do List sample. An example of how to use a parameter-from-action connection follows:
1. Place a Push Button part and a List part within the default Window part in the Composition Editor.
2. Now, place an Ordered Collection part and an Object Factory part onto an open area of the Composition Editor free-form surface. Both the Ordered Collection part and the Object Factory part can be found in the Models category of the Composition Editor.
3. Bring up the property view for the Object Factory part by double-clicking on it and set the instanceClass property value by typing in OrderedCollection. Be sure to maintain the exact case.
4. Connect the clicked event of Push Button part to the add: action of the Ordered Collection part.
5. Then, make the parameter-from-action connection by connecting the new action from the Object Factory part's Connect menu to the anObject attribute in the connection's pop-up menu. This provides the needed connection parameter and causes the connection line to become solid in color.
6. Finally, connect the self attribute of the Ordered Collection to the items attribute of the list. This connection allows us to prove the new instances of the OrderedCollection are indeed created by displaying the results in a list part.
Last modified date: 06/27/2019