Using the reusable visual part
Now that you have created the reusable visual part, and promoted the appropriate features to the public interface of ReusableRoadRaceView, let's use it in RoadRaceView.
Open the Composition Editor for RoadRaceView.
Delete all the parts except the Result Label part, Result Text part, and your nonvisual Runner part. Do this by selecting Delete from each part's pop-up menu. Select OK when asked whether you are sure you want to delete the part and its connections.
When you are through with the deletions, your Composition Editor window looks like the following:
After parts deleted
Select Add Part from the Options menu. Type in ReusableRoadRaceView for the Class Name and select OK. Click mouse button 1 in the upper left corner of the Window part.
If you change the settings for parts in the ReusableRoadRaceView form, those changes propagate automatically to RoadRaceView. However, if you change the size of the original form and you want that change to propagate to RoadRaceView, you must copy and paste the form again.
Make the connections as follows:
Connect the runnerNumberTextObject attribute of ReusableRoadRaceView to the number attribute of the Runner part.
Connect the finishTimeTextObject attribute of ReusableRoadRaceView to the finishTime attribute of the Runner part.
When you finish, your connections look like the following:
Connections
Select Save Part from the File menu.
Select Test iconto test your window. It should work exactly as before.
Last modified date: 07/15/2020