Buttons¶
Clickable buttons that trigger actions.
Creating a Button¶
With Custom ID¶
Adding Click Handler¶
Complete Example¶
gui_init("com.example.button");
let window = gui_window("Button Demo", 300, 200);
let button = gui_button("Click Me");
let click_count = 0;
fn handle_click() {
click_count = click_count + 1;
print "Clicked #{click_count} times";
}
gui_on(button, "clicked", "handle_click");
gui_add(window, button);
gui_run();