Containers: Controlling the View

Containers coordinate the storage and display of graphic objects.

A Container

Fundamentally, a container is a view, with predefined callbacks to handle the automatic refresh of the graphic objects it stores, as well as the system events and user events that occur in that view.

Each graphic object stored in a container is unique and can only be displayed by that container. In short, a container:

  • is essentially another kind of view where you can collect any number of graphic objects.

  • automatically manages all drawing operations within the view.

  • can associate interactors to its objects to give them particular behaviors.

  • lets you access objects by their names.

  • can use a transformer to move, zoom, and rotate when drawing objects.

  • associates single actions with events received by the view.

Containers versus Managers

Views groups objects in one of two basic types of storage data structures:

  • Containers

  • Managers

A view is associated with a set of graphic objects stored in a container or manager.

A container stores a certain number of graphic objects, and it is associated with a view, which displays the objects stored in the container. Each object can be associated with a specific behavior, and accelerators—which are keyboard events that immediately call a predefined function—can be attached to the container itself. Containers are part of the functionality of the Foundation package.

A manager is another type of data structure that provides layers, multiple-view, fast redraw, persistency, and editing functionality. For details on managers see the Managers documentation.

Note

For efficient drawing of numerous objects, multiple views, and layers, you should use the managers instead of containers.