Open AtlanCI opened 5 years ago
Description file `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
`
After I change the Create function behind the MainWindow structure to the Run function, it will work properly. `package main
import ( "fmt" "github.com/lxn/walk" . "github.com/lxn/walk/declarative" ) type MyMainWindow struct { walk.MainWindow } func main() { mw := new(MyMainWindow) var showAboutBoxAction walk.Action MainWindow{ AssignTo: &mw.MainWindow, Title: "Walk Actions Example", MinSize: Size{300, 200}, //菜单项
MenuItems: []MenuItem{
Menu{
Text: "&Help",
Items: []MenuItem{
Action{
//赋值给谁
AssignTo: &showAboutBoxAction,
Text: "About",
//处罚函数
OnTriggered: func() {
walk.MsgBox(mw, "About", "Walk Actions Example", walk.MsgBoxIconInformation)
},
},
},
},
},
Layout: VBox{},
Children: []Widget{
PushButton{
Text: "Enable Special Mode",
OnClicked: func() {
fmt.Println("别摸我" )
},
},
},
}.Run()
}
`
I hope this will help you.
` package main
import ( "fmt" "github.com/lxn/walk" . "github.com/lxn/walk/declarative" ) type MyMainWindow struct { walk.MainWindow } func main() { mw := new(MyMainWindow) var showAboutBoxAction walk.Action MainWindow{ AssignTo: &mw.MainWindow, Title: "Walk Actions Example", MinSize: Size{300, 200}, //菜单项
} `