Application Basics

A Forms application creates windows and controls, processes platform events, and runs the event loop. The inherited event loop also supports I/O, timers, and asynchronous operations.

Application is the root element of the hierarchy. It provides the main Screen, which represents a display and owns its top-level WindowManager. A WindowManager can also be embedded in a Workspace. Windows attach to a window manager; each window is a Form that acts as the root of one control tree.

The following diagram shows the inheritance hierarchy. It does not describe the runtime parent relationship between controls.

Responder
Widget
Screen
View
Form
Window
Control
Label

Screen and View are Widget types. A widget supplies the common geometry, visibility, repainting, scaling, screen-connection, and event-processing behavior. The platform backend submits events to the application event loop, which dispatches them to widgets. Every widget is also a Responder. This lets input events travel through the responder chain.

Form and Control are View types. A form has one main content control; a control can have several child controls. Together, these controls form the visible user interface. A form is the layout root for its content tree, while each control is responsible for the geometry of its direct children. Layouting happens in two passes. The first pass determines the space each control needs. The second pass arranges the controls within the available space.

A view provides a PaintSurface for its attached controls and translates coordinates at the boundary between the view and each control. A window is connected to the paint surface supplied by its internal WindowFrame. The frame uses a pixmap surface that the display presents after painting.

Changes to visual state or layout normally request a repaint. The repaint request travels upward through the views to the window and its window frame. Painting then travels downward again: the window paints its content, and forms and controls paint their visible children.