A checkbox with a caption. Returns true on the frame the value changed.
- value: the flag to show and toggle. It is changed in place.
- text: a caption next to the box. Empty for none.
- loc: the call site. It identifies the widget from one frame to the next, so leave the default.
on := false;
ui := headless();
defer free_ui(*ui);
build := (value: *bool) { checkbox(value, "Dark mode"); };
frame(*ui, *on, build);
click(*ui, find_role(*ui, .CHECKBOX));
frame(*ui, *on, build);
assert(on);checkbox :: (
value: *bool,
text: string = "",
loc := #caller_location
) -> changed: bool
A checkbox with a caption. Returns true on the frame the value changed.
Parameters
- value: *bool
- the flag to show and toggle. It is changed in place.
- text: string = ""
- a caption next to the box. Empty for none.
- loc := #caller_location
- the call site. It identifies the widget from one frame to the next, so leave the default.
Returns
- changed: bool
on := false;
ui := headless();
defer free_ui(*ui);
build := (value: *bool) { checkbox(value, "Dark mode"); };
frame(*ui, *on, build);
click(*ui, find_role(*ui, .CHECKBOX));
frame(*ui, *on, build);
assert(on);