Move the pointer to the centre of node and click it. The next frame applies it and shows the result. node must come
from a frame that has already laid it out.
- ui: the UI to send the click to.
- node: the node to click. Null does nothing.
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);
click(*ui, find_label(*ui, "Add"));
frame(*ui, *count, build);
assert(count == 1);click :: (ui: *UI_State, node: *Node)
Move the pointer to the centre of node and click it. The next frame applies it and shows the result. node must come
from a frame that has already laid it out.
Parameters
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);
click(*ui, find_label(*ui, "Add"));
frame(*ui, *count, build);
assert(count == 1);