Working with IVSequence Parts

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

Setting the collection object type
To specify the type of objects in the collection, select Change Template Arguments from the part pop-up menu. Then, in the Change Template Arguments window, set the class Element property. Enter a pointer to the part type (part type and *) in the value column.

Setting initial contents
To specify initial objects in the collection, set the initialContents property in the IVSequence* property sheet. Open the Array of strings prompter window for the value column. Then, enter code that creates pointers to objects in the sequence. For example, if the sequence holds ICustomer* objects, type something like the following:
  new ICustomer("Flora");
  new ICustomer("Kathy");
  new ICustomer("Terry");

Adding an object
To add a given object to the collection when a push button is pressed, connect the IPushButton* buttonClickEvent feature to the IVSequence* add action. Then, connect the this attribute of the object to the buttonClickEvent-to-add connection, providing the element parameter for the add action.

Removing an object
You might need to remove an object from the collection based on its index. For example, the user might select a push button to remove the selected object item from an ICollectionViewComboBox* part. An ICollectionViewComboBox* selection attribute provides the index.

To remove an object with a known index from the collection when a push button is pressed, connect the IPushButton* buttonClickEvent feature to the IVSequence* removeAtPosition action. Then, connect the index to the buttonClickEvent-to-removeAtPosition connection, providing the position parameter for the removeAtPosition action.


Related procedures
Setting Template Arguments
Working with VisualAge User Interface Parts

Related references
IVSequence
Property Settings -- IVSequence
Portability -- IVSequence