Checkboxes¶
Toggle checkboxes for on/off options.
Creating a Checkbox¶
Getting State¶
Setting State¶
Example¶
gui_init("com.example.checkbox");
let window = gui_window("Checkbox Demo", 300, 200);
let box = gui_box("vertical", 10);
let checkbox = gui_checkbox("Accept terms");
let button = gui_button("Submit");
let result = gui_label("");
fn submit() {
let accepted = gui_get_checked(checkbox);
if accepted == true {
gui_set_text(result, "Terms accepted!");
} else {
gui_set_text(result, "Please accept terms");
}
}
gui_on(button, "clicked", "submit");
gui_add(box, checkbox);
gui_add(box, button);
gui_add(box, result);
gui_add(window, box);
gui_run();