MAIN-WINDOW:
Factor handbook » UI framework » Building user interfaces » Top-level windows

Prev:WINDOW:


Vocabulary
ui

Syntax
MAIN-WINDOW: window-word { attributes } attribute-code ;


Word description
Defines a MAIN: word for the current vocabulary named window-word that opens a UI window when the vocabulary is run. The attributes specify the key-value pairs of the window's world-attributes. The attribute-code is run with the world-attributes on the stack; this allows the word to construct gadget objects to place in the gadget slot or set other runtime-dependent world attributes.

Examples
From the hello-ui vocabulary. Creates a window with the title "Hi" containing a label reading "Hello world":
USING: accessors ui ui.gadgets.labels ; IN: hello-ui MAIN-WINDOW: hello { { title "Hi" } } "Hello world" <label> >>gadgets ;


See also
WINDOW:

Definition