UI module

layout_dump

procedureextensionexperimentalsince 0.31.0Source

The tree as indented text: role, label or text, and the rectangle of each node. Useful as a snapshot of a layout.

Example↗
ui := headless(.{ width = 320, height = 200 });
defer free_ui(*ui);
count := 0;
build := (n: *int) {
    for column(.{ gap = 8, padding = 16 }) {
        label(tprint("Clicked % times", n.*));
        if button("Add") n.* += 1;
    }
};
frame(*ui, *count, build);
dump := layout_dump(*ui);
assert(dump.count > 0);
print("%", dump);
layout_dump :: (ui: *UI_State) -> string

The tree as indented text: role, label or text, and the rectangle of each node. Useful as a snapshot of a layout.

Parameters

ui: *UI_State
the UI to dump.

Returns

string
Example↗
ui := headless(.{ width = 320, height = 200 });
defer free_ui(*ui);
count := 0;
build := (n: *int) {
    for column(.{ gap = 8, padding = 16 }) {
        label(tprint("Clicked % times", n.*));
        if button("Add") n.* += 1;
    }
};
frame(*ui, *count, build);
dump := layout_dump(*ui);
assert(dump.count > 0);
print("%", dump);

See also