UI module

frame

procedure · 1 overloadsince 0.31.0Source

Run one frame with the app's build procedure.

Queued input is applied first, against the previous frame's layout, and build reacts to it while it runs (button returns true, a text editor takes the typed text). A widget declared above the one that reacted has already been drawn from the old state, so when the frame had input it builds once more with the input spent: what you queued shows in the tree and the layout when frame returns. build therefore runs twice on such a frame, and the second run sees no clicks, keys or focus changes. A frame without input builds once.

frame :: (ui: *UI_State, app: *$T, build: (app: *T))

Run one frame with the app's build procedure.

Queued input is applied first, against the previous frame's layout, and build reacts to it while it runs (button returns true, a text editor takes the typed text). A widget declared above the one that reacted has already been drawn from the old state, so when the frame had input it builds once more with the input spent: what you queued shows in the tree and the layout when frame returns. build therefore runs twice on such a frame, and the second run sees no clicks, keys or focus changes. A frame without input builds once.

Parameters

ui: *UI_State
the UI to run the frame on.
app: *$T
your app state, passed to build.
build: (app: *T)
declares the widgets for the frame.

See also