A Forms application constructs its visual hierarchy, shows its windows, and runs the event loop. The inherited event loop also supports I/O, timers, and asynchronous operations.
Application is the runtime root. Construct it before forms, windows, or controls. It is not a Widget. The application provides the primary Screen and its WindowManager, dispatches platform events, and owns the shared scaling, style, font, and input-method services.
The C++ class hierarchy and the visual hierarchy describe different relationships. The following diagram shows inheritance only. It does not describe which objects display or contain other objects. In particular, Window derives from Form; it is not a direct child of View.
The visual hierarchy describes how Forms objects appear together. Each level follows the same non-owning host pattern: Application provides the Screen, a WindowManager attaches Window objects, a Form attaches one content Control, and a Control attaches child controls, including layouts. A Workspace applies the same pattern inside an ordinary control: its window manager presents several windows within the workspace bounds.
Attaching a window or control does not transfer ownership. The code that creates an object keeps it alive while the hierarchy uses it. A window or control removes itself from its parent when it is destroyed.
The following example creates a visual hierarchy with a window, its content layout, and a control displayed by that layout.
Classes | |
| class | Application |
| Provides the runtime root of a Forms user interface. More... | |
Modules | |
| Widgets and Views | |
| Widget and view object model. | |
| Windows and Workspaces | |
| Windows and workspace management. | |
| Layouting and Painting | |
| Invalidate, layouting, and painting of visual content. | |
| Pointer and Keyboard Input | |
| Pointer, keyboard, and text-entry input. | |
| Layouts | |
| Arrangement of child controls. | |
| Buttons | |
| Commands and boolean choices. | |
| Displays | |
| Text, panels, and progress without editing. | |
| Editors and Selectors | |
| Text, numbers, lists, and ranges for entering or picking a value. | |
| Collections | |
| Lists, tabs, and scrollable content. | |
| Menus | |
| Menu bars and popup menus for commands and context actions. | |
| Icons and Text | |
| Icons and textual content for controls. | |
| Styles and Renderers | |
| Styles, options, and renderers for widget appearance. | |