UI module

scroll

procedureextensionexperimentalsince 0.31.0Source

A column whose content scrolls vertically (horizontally with axis = .HORIZONTAL) when it is larger than the space it is given. Give it grow = 1 or a fixed size.

Example↗
ui := headless(.{ width = 200, height = 100 });
defer free_ui(*ui);
frame(*ui, *ui, (u: *UI_State) {
    for scroll(.{ height = 100 }) {
        for 0..19 label(tprint("line %", it));
    }
});
assert(find_role(*ui, .SCROLL) != null);
scroll :: (
    style: Style = .{},
    axis: Axis = .VERTICAL,
    loc := #caller_location
) -> Container

A column whose content scrolls vertically (horizontally with axis = .HORIZONTAL) when it is larger than the space it is given. Give it grow = 1 or a fixed size.

Parameters

style: Style = .{}
layout and paint options for the container.
axis: Axis = .VERTICAL
the scrolling direction.
loc := #caller_location
the call site. It identifies the widget from one frame to the next, so leave the default.

Returns

Example↗
ui := headless(.{ width = 200, height = 100 });
defer free_ui(*ui);
frame(*ui, *ui, (u: *UI_State) {
    for scroll(.{ height = 100 }) {
        for 0..19 label(tprint("line %", it));
    }
});
assert(find_role(*ui, .SCROLL) != null);

See also