Working with IVBContainerControl Parts

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

Placing a container control in a frame window client area
If you want to fill the client area of a frame window with a container, we recommend that you use an IMultiCellCanvas* part as the frame window client control. Define the IMultiCellCanvas* part with one row and one column, both expandable. Then, place an IVBContainerControl* part on the single expandable cell of the IMultiCellCanvas* part.

Defining a container title
To define a container title for the details view, set the following properties in the IVBContainerControl* property sheet:

Setting the collection type
To specify the type of collection containing the objects, select Change Template Arguments from the part pop-up menu. Then, in the Change Template Arguments window, set the class Collection property. Enter the type you want in the value column. The default collection type is IVSequence.

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.

Specifying object representation
To define how objects are represented in the container, set the Attribute for icon text and Attribute for icon properties in the IVBContainerControl* property sheet.

Specifying PM compatibility
To provide a PM-compatible container, open the style property in the IVBContainerControl* property sheet and set the pmCompatible style to on.

Setting the initial view
To set the initial view for the container, set the viewType property in the IVBContainerControl* property sheet. Select a view choice in the value column. To work with container columns from the composition surface, select the showDetailsView choice. Otherwise, select View parts list from the pop-up menu of the container, then open settings from the pop-up menu of the container column in the Parts List window.

Adding a column
To add a column for the details view of the container, select an IContainerColumn* part from the parts palette and drop it on the IVBContainerControl* part.

To work with the IContainerColumn* part in the Composition Editor, set the initial view of the container to be the details view. When you have finished working with container columns, change the initial view to the view you want initially displayed.

Reordering columns
To reorder container columns, open the IVBContainerControl* pop-up menu and select View parts list. Then, in the parts list window, drag IContainerColumn* parts within the list to reorder them.

Automatically positioning icons
To automatically position object icons in the icon view when objects are added to the container, open the style property in the IVBContainerControl* property sheet and set the autoPosition style to on.

Defining selection
To specify the selection mode for the container, open the style property in the IVBContainerControl* property sheet. Then, specify one of the following selection modes:

Single selection
Allows the user to select only one object. This is the only selection mode supported in a tree view of a container. Set the singleSelection style to on, or accept it as the <default> choice.

Multiple selection
Allows the user to individually select multiple objects. Set the multipleSelection style to on.

Extended selection
Allows the user to select multiple objects by dragging the mouse over them or by pressing either the Shift key or the Ctrl key during selection. Extended selection is available only with a PM-compatible container. Set the extendedSelection style to on.

The class default style is shipped with single selection as the default mode.

Loading container objects
To load a set of objects into the container, connect the this attribute of a collection part containing the choices to the IVBContainerControl* items attribute. You must use a collection part that has one template argument, such as an IVSequence* part.

Enabling direct editing of containers and objects
To enable users to directly edit a container and container objects, do the following:

Calling an action for a container object
To start an action when the user double-clicks a container object or selects an object and presses the Enter key, connect the IVBContainerControl* enterEvent feature to the action.

Getting selected objects
To get objects for an action parameter, do one of the following:

If you make a connection from either the selectedItem attribute or the button2Item attribute, the target should expect an object of the type specified for the container. For example, if the container holds ICustomer* objects, the target should accept an ICustomer* object.

If you make a connection from either the selectedItems attribute or the button2Items attribute, the target should expect a collection of objects of the type specified for the container. For example, if the container holds ICustomer* objects, the target should accept a collection of ICustomer* objects.


Related procedures
Setting Template Arguments
Common Tasks for Control Parts
Setting Part Style Properties
Setting Part Color Properties
Setting Part Font Properties
Setting Part Handlers Properties
Setting Part Framing Properties
Providing Drag and Drop Support
Working with VisualAge User Interface Parts

Related references
IVBContainerControl
Property Settings -- IVBContainerControl
Portability -- IVBContainerControl