CompositeView:
Filter:
Classes | GUI > Views

CompositeView

A view that contains other views.
Location: NOT INSTALLED!

Description

NOTE: In Qt GUI, every view can be a parent to other views, so CompositeView redirects to the same class as View - you can use the latter equivalently.

CompositeView can be used as the parent of other views, while also being a child of a Window or another CompositeView itself. Aside from that it has not special methods of its own.

NOTE: In Cocoa GUI, this view accepts key actions, but not mouse clicks or drags.

Class Methods

Inherited class methods

Instance Methods

Inherited instance methods

Examples

Coordinate System

Containers use relative coordinates, i.e. views are placed relative to the upper left corner of the container.

Keydown Bubbling

Key actions "bubble up" to the parent view if a view does not define one itself. In the following example, a and b do not have keyDown actions themselves, so the key event is passed to c, the parent, which defines the key down action. d's parent is the SCTopView, which has no key down action. See also View.

Decorators

A 'decorator' object can be set to handle layout management. All views added to the CompositeView will now be placed by the decorator. Currently the only one existing is FlowLayout. You can use the ContainerView's addFlowLayout method as a short cut to assigning FlowLayout to decorator.

You can also use an empty composite view nicely as a spacer in VLayoutView, HLayoutView, or views that have a FlowLayout as their decorator.

Hiding / Swapping

You can stack CompositeViews on top of each other and use a button show only one of them:

Nested Example

In this example, the StaticText accepts mouse clicks, since container views can't: