How Do I...

Example: Wrapper an input window

Use view wrappers No tip for this topic No example for this topic Start external programs

This example shows how to wrapper a view that prompts users to specify a customer name, then use the wrappered view in another view that displays the specified name.

Making the part to be wrappered

Begin by creating an application, adding a visual part to it, and opening a Composition Editor on the visual part. Then, in the Composition Editor, make the following user interface:
Add customer window

So other parts can use the data entered into the text field, add scripts that provide a public interface for the text field:

  1. Select Public Interface Editor in the lower-right corner of the Composition Editor to open a Public Interface Editor for the visual part.
  2. In the Attribute tab, type the following into the Attribute name field:
    customerName
     
    
  3. Select the Add with defaults button.
  4. From the File pull-down menu, select Generate Default Scripts.
  5. In the window that opens, select Generate All.

Next, return to the Composition Editor and add the following connections:

After you make the connections, the Composition Editor shows the following:
Add customer with connections

Finally, save the part.

Making the part that uses a view wrapper

Now make the part that uses the part you just made. Begin by adding a new visual part to your application, and opening a Composition Editor on it. Then, in the Composition Editor, make the following user interface:
Customer user interface

Next, select Models category icon (Models category) and View Wrapper icon (View Wrapper part), then click on the free-form surface. Open the settings for the part and specify the following in the partName field:

Add customer

Then set the viewPartClass field to the name which you gave the part to be wrappered.

Adding the remaining connections

So the part you've just made can use the wrappered part, add the following connections:

Also add two connections that enable users to delete the contents of the text field in the Customer window:

The Composition Editor now displays the following:
Customer window

Test and save your work.


[ Top of Page | Previous Page | Next Page | Table of Contents ]