mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[examples] update label on click
This commit is contained in:
@@ -29,7 +29,13 @@ func main() {
|
||||
|
||||
// Click callbacks
|
||||
myMenu.Add("Click Me!").OnClick(func(ctx *application.Context) {
|
||||
ctx.ClickedMenuItem().SetLabel("Thanks mate!")
|
||||
label := ctx.ClickedMenuItem().Label()
|
||||
if label == "Click Me!" {
|
||||
label = "Thanks mate!"
|
||||
} else {
|
||||
label = "Click Me!"
|
||||
}
|
||||
ctx.ClickedMenuItem().SetLabel(label)
|
||||
})
|
||||
|
||||
// You can control the current window from the menu
|
||||
|
||||
Reference in New Issue
Block a user