diff --git a/counter b/counter new file mode 100755 index 0000000..8eece2b Binary files /dev/null and b/counter differ diff --git a/examples/counter/main.go b/examples/counter/main.go index 1adcdb6..839a95a 100644 --- a/examples/counter/main.go +++ b/examples/counter/main.go @@ -25,6 +25,11 @@ func main() { count.Set(count.Get() + 1) }, ui.TextFromString("Increment"))) + // Button that decrements the count on click + view.Child(ui.Button(func() { + count.Set(count.Get() - 1) + }, ui.TextFromString("Decrement"))) + ui.NewApp(view) select {}