var lab *walk.Label
var text *walk.TextEdit
var txt *walk.LineEdit
var button *walk.PushButton
mw := new(MyMainWindow)
if err := (MainWindow{
AssignTo: &mw.MainWindow,
Title: "通讯服务器",
MinSize: Size{500, 600},
Layout: VBox{},
Children: []Widget{
Label{
AssignTo: &lab,
Text: "监听端口",
},
LineEdit{
AssignTo: &txt,
},
PushButton{
AssignTo: &button,
Text: "保存",
OnClicked: func() {
str := "[service]" + "\r\n"
str = str + "SocketPort=" + txt.Text()
file, _ := os.Create(fpath)
w := bufio.NewWriter(file)
w.WriteString(str)
w.Flush()
file.Close()
var hwnd winapi.HWND
winapi.MessageBox(hwnd, Text("保存成功请重启生效"), Text("提示"), winapi.MB_OK)
},
},
TextEdit{
AssignTo: &text,
},
},
}.Create()); err != nil {
_, _, line, _ := runtime.Caller(0)
logPrintln(line, err.Error())
}
lab.SetBounds(walk.Rectangle{10, 10, 50, 20})
txt.SetBounds(walk.Rectangle{70, 10, 100, 20})
button.SetBounds(walk.Rectangle{190, 10, 80, 20})
text.SetBounds(walk.Rectangle{15, 60, 465, 490})
这种情况下 运行的时候可以正常显示 如果最小化之后 控件就不能到指定的位置了
求教啊
有疑问加站长微信联系(非本文作者)