From 804816dd6fbfe23ba1e302b3c88c6e07606b28ac Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Wed, 12 Oct 2022 20:59:02 +1100 Subject: [PATCH] Update example --- v2/examples/systray/.gitignore | 1 + v2/examples/systray/main.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/v2/examples/systray/.gitignore b/v2/examples/systray/.gitignore index 8e52319e5..9fc08b5e3 100644 --- a/v2/examples/systray/.gitignore +++ b/v2/examples/systray/.gitignore @@ -1,2 +1,3 @@ build/bin node_modules +frontend/wailsjs diff --git a/v2/examples/systray/main.go b/v2/examples/systray/main.go index 0d25f4968..468d2be72 100644 --- a/v2/examples/systray/main.go +++ b/v2/examples/systray/main.go @@ -78,9 +78,9 @@ func main() { // This is a menuitem we will show/hide at runtime visibleNotVisible := menu.Label("visible?").Show() - var counter int + counter := 0 icons := [][]byte{lightModeIcon, darkModeIcon} - iconCounter := 1 + iconCounter := 0 disabledEnabledMenu := menu.Label("disabled").Disable().OnClick(func(c *menu.CallbackData) { println("Disabled item clicked!") @@ -112,8 +112,8 @@ func main() { visibleNotVisible, // This menu item changes its label when clicked. menu.Label("Click Me!").OnClick(func(c *menu.CallbackData) { - c.MenuItem.SetLabel(fmt.Sprintf("Clicked %d times", counter)) counter++ + c.MenuItem.SetLabel(fmt.Sprintf("Clicked %d times", counter)) systray.Update() }),