mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-17 01:19:29 +08:00
[v3 example] menu text toggle
This commit is contained in:
parent
d1085b5bea
commit
fa74986f1e
@ -29,7 +29,12 @@ func main() {
|
|||||||
|
|
||||||
// Click callbacks
|
// Click callbacks
|
||||||
myMenu.Add("Click Me!").OnClick(func(ctx *application.Context) {
|
myMenu.Add("Click Me!").OnClick(func(ctx *application.Context) {
|
||||||
|
switch ctx.ClickedMenuItem().Label() {
|
||||||
|
case "Click Me!":
|
||||||
ctx.ClickedMenuItem().SetLabel("Thanks mate!")
|
ctx.ClickedMenuItem().SetLabel("Thanks mate!")
|
||||||
|
case "Thanks mate!":
|
||||||
|
ctx.ClickedMenuItem().SetLabel("Click Me!")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// You can control the current window from the menu
|
// You can control the current window from the menu
|
||||||
|
Loading…
Reference in New Issue
Block a user