Working with Factory Parts

The following tasks are associated with using a Factory* part in visual composition. Tasks that are common to many parts are described in related topics.

Setting the object type
To specify the object type that the factory creates, open the factory's pop-up menu. Then, select the Change type choice and enter a pointer to the object type you want (ObjectType*).

To have the factory create objects defined by a template class, you must specify the template arguments. For example, for a sequence of ICustomer instances, specify IVSequence<ICustomer*> *.

Defining a variable for dynamically created objects
To work with an object created by the factory, you need to define a variable for the object. Do this as follows:
  1. Add a Variable part from the parts palette, or use the Add Part window to add the object part as a variable.

  2. If you added a Variable part from the parts palette, change the variable type to the part type of your secondary window.

Creating objects
To create an object when an event occurs, do the following:
  1. Connect the event to the factory's new action.

  2. Connect the factory's newEvent feature to the this attribute of a Variable part that you defined for objects created by the factory.

Destroying a dynamically created object
To destroy a dynamically created object when you are done with it, do one of the following:


Related procedures
Working with VisualAge User Interface Parts

Related references
Factory
Property Settings -- Factory
Portability -- Factory