[examples] update label on click

This commit is contained in:
Travis McLane
2023-05-10 09:10:03 -05:00
parent a9d834d715
commit b1e79411e7
+7 -1
View File
@@ -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