UI module

Node_Events

structextensionexperimentalsince 0.31.0Source

What happened to a node this frame, from the input events routed to it.

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);
node := find_label(*ui, "Add");
click(*ui, node);
frame(*ui, *count, build);
events := events_of(*ui, find_label(*ui, "Add"));
assert(events.hovered);

Fields

hovered: bool
pressed: bool
the primary button is down on it
clicked: bool
the primary button went down and up on it
double_clicked: bool
focused: bool
focus_gained: bool
focus_lost: bool

See also