-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshowtool.go
87 lines (83 loc) · 1.56 KB
/
showtool.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main
import (
"fmt"
"github.com/astaxie/beego/logs"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
func ShowToolBar(cfg *LinkConfig) {
var dlg *walk.Dialog
var acceptPB *walk.PushButton
cnt, err := Dialog{
AssignTo: &dlg,
Title: "Link Detail",
Icon: walk.IconInformation(),
DefaultButton: &acceptPB,
Size: Size{250, 150},
MinSize: Size{250, 150},
Layout: VBox{
Alignment: AlignHNearVCenter,
Margins: Margins{Top: 10, Bottom: 10, Left: 10, Right: 10},
},
Children: []Widget{
Composite{
Layout: Grid{Columns: 2},
Children: []Widget{
Label{
Text: "Listen Address:",
},
Label{
Text: cfg.Address,
},
Label{
Text: "Listen Port:",
},
Label{
Text: fmt.Sprintf("%d", cfg.Port),
},
Label{
Text: "Listen Tls:",
},
Label{
Text: cfg.Tls,
},
Label{
Text: "Backend Address:",
},
Label{
Text: cfg.Backend.Address,
},
Label{
Text: "Backend Port:",
},
Label{
Text: fmt.Sprintf("%d", cfg.Backend.Port),
},
Label{
Text: "Backend Tls:",
},
Label{
Text: cfg.Backend.Tls,
},
},
},
Composite{
Layout: VBox{},
Children: []Widget{
PushButton{
AssignTo: &acceptPB,
Text: "OK",
OnClicked: func() {
dlg.Cancel()
},
},
},
},
},
}.Run(MainWindowsCtrl())
if err != nil {
logs.Error(err.Error())
} else {
logs.Info("show link dialog return %d", cnt)
}
}