UI module

find_label

procedureextensionexperimentalsince 0.31.0Source

The first node with this label.

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);
assert(find_label(*ui, "Add") != null);
assert(find_label(*ui, "Remove") == null);
find_label :: (ui: *UI_State, label: string) -> *Node

The first node with this label.

Parameters

ui: *UI_State
the UI to search.
label: string
the label to match exactly.

Returns

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);
assert(find_label(*ui, "Add") != null);
assert(find_label(*ui, "Remove") == null);

See also