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:
- Add a Variable part from the parts palette, or
use the Add Part window to add the object part as
a variable.
- 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:
- Connect the event to the factory's new
action.
- 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:
- If the object has been placed in a Variable part,
set the autoDeleteTarget property in the
variable's property sheet. Select true in
the value column.
- Set the autoDeleteObject property in the
factory's property sheet. Select true in
the value column.
Working with VisualAge User
Interface Parts
Factory
Property Settings --
Factory
Portability -- Factory