With your Runner part fully defined, you are now ready to use it in a visual part.
In the VisualAge Organizer, create a visual part named RoadRaceView.
In the Composition Editor, construct a visual part that looks similar to
this:
Set the settings for the three Text parts as follows:
Add your Runner part as follows:
Note: | This is the informal way of adding your part to a visual part. You can also formally add your part to the parts palette and use it directly from there. To learn how, see Extending the parts palette. |
Select Connect from the runner part's pop-up menu and notice that the three attributes you defined for your part are listed in the dialog: number, finishTime, and runnerAsResultString.
Connect your nonvisual Runner part to your visual parts as follows:
When you have made all the connections, your view in the Composition Editor
looks like the following:
Select Save Part from the File menu.
Select
to test your visual part.
Try entering a Runner number of 451 and a Finish time of 13:45:21.
Notice that Result is automatically updated as Runner number and Finish time change. Remember that this is due to the Runner part's global runnerChanged event that refreshes the runnerAsResultString attribute whenever the number or finishTime attributes change. (If the result does not update automatically on your system, click on the Runner number text pane.)
You have now successfully created and used your own nonvisual part.