Creating a reusable part
The visual parts you construct in the Composition Editor are composite parts because they contain other parts, known as subparts. What's great about VAST Platform is that you can use a composite visual part just like any other part. So, if you construct your parts carefully, you can reuse them throughout your application and in other applications.
Every visual part must have a primary part. Typically, this is the Window part. However, to create a reusable composite part you use a Form part, which you must make the primary part. The Form part is similar to a Window part, except that it doesn't have a frame border. This makes the part ideal for embedding into a window or some other part in your user interface.
Creating a reusable Form part
1. On the Organizer, from the Parts pull-down menu, select New Part.
2. On the New Part window, in the Part class field, type SecurityFormView; in the Part type field, select Visual part; then select OK.
3. When the Composition Editor opens, delete the default Window part that appears by selecting Delete from the Window part's pop-up menu.
4. From the Canvas category
add a Form part
.
Because you delete the Window part first, then add the Form part, the Form part automatically becomes the primary part.
Note:
To make a part the primary part, select Become Primary Part from its pop-up menu. If a part's pop-up menu doesn't have a Become Primary Part choice, the part is already the primary part. Nonvisual parts cannot be made the primary part.
Create the user interface for the reusable part
The SecurityFormView part is now ready for you to create the user interface.
1. Add the necessary parts to the Form part and edit their labels so the form looks like what is shown in
Creating a reusable part.
1. As you add parts on top of the form part, they automatically become children of the form part, just as with a window part.
2. Be sure to use the Formatted Text part for the
Price per share,
Shares owned and
Total value fields and set their
format property to
Monetary. Refer to
Validating and formatting data for information about setting the format property in a Formatted Text part.
4. Because all of the Text parts are intended for output only, change their properties so that they are read-only. You do this by setting their editable property to false
5. Save your work by selecting Save part from the File pull-down menu then close the Composition Editor.
You have now finished creating a visual part that we will later reuse.
Last modified date: 02/16/2023