From 1c8d4a16774a17c4b04d33087b2f9e8ab1b9ca50 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sun, 5 Dec 2021 03:13:42 +0500 Subject: [PATCH] Add button --- src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.rs b/src/main.rs index aac12f7..ddb63b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,5 +17,19 @@ fn build_ui(app: &Application) { .title("Hello, World!") .build(); + let button = Button::builder() + .label("Press me!") + .margin_top(12) + .margin_bottom(12) + .margin_start(12) + .margin_end(12) + .build(); + + button.connect_clicked(move |button| { + button.set_label("Hello, World!"); + }); + + window.set_child(Some(&button)); + window.present(); }