-
Notifications
You must be signed in to change notification settings - Fork 479
/
Copy pathwalk.go
44 lines (40 loc) · 863 Bytes
/
walk.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
// go build -ldflags="-H windowsgui"
func main() {
var username, password *walk.TextEdit
MainWindow{
Title: "QQ",
Size: Size{Width: 350, Height: 100},
Layout: VBox{},
Children: []Widget{
VSplitter{
Children: []Widget{
HSplitter{
Children: []Widget{
TextLabel{Text: "用户名"},
TextEdit{AssignTo: &username},
},
},
HSplitter{
Children: []Widget{
TextLabel{Text: "密码"},
TextEdit{AssignTo: &password},
},
},
},
},
PushButton{
Text: "登陆",
OnClicked: func() {
if username.Text() == "admin" && password.Text() == "admin" {
walk.MsgBox(&walk.MainWindow{}, "成功", "登陆成功: "+username.Text(), walk.MsgBoxOK)
}
},
},
},
}.Run()
}