本文整理汇总了Golang中github.com/lxn/walk.TextEdit.AppendText方法的典型用法代码示例。如果您正苦于以下问题:Golang TextEdit.AppendText方法的具体用法?Golang TextEdit.AppendText怎么用?Golang TextEdit.AppendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxn/walk.TextEdit
的用法示例。
在下文中一共展示了TextEdit.AppendText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var (
msgbox *walk.TextEdit
inputUN *walk.LineEdit //input username
inputPW *walk.LineEdit //input password
myPB *walk.PushButton
)
MainWindow{
Title: "soramail",
MinSize: Size{640, 480},
Layout: VBox{},
Children: []Widget{
TextEdit{
AssignTo: &msgbox,
Text: "Hello, World",
ReadOnly: true,
},
HSplitter{
MaxSize: Size{640, 20},
Children: []Widget{
LineEdit{
AssignTo: &inputUN,
Text: "username",
},
LineEdit{
AssignTo: &inputPW,
Text: "password",
},
PushButton{
AssignTo: &myPB,
Text: "Push",
OnClicked: func() {
msgbox.AppendText("\r\nHello," + inputUN.Text() + ".\r\nYour password is " + inputPW.Text())
},
},
},
},
},
}.Run()
}
示例2: sendThread
func sendThread(msgbox, es *walk.TextEdit) {
sendTo := strings.Split(SJ.Send, "\r\n")
susscess := 0
count := len(sendTo)
for index, to := range sendTo {
if runing == false {
break
}
msgbox.SetText("发送到" + to + "..." + strconv.Itoa((index/count)*100) + "%")
err := SendMail(SJ.Name, SJ.Pwd, SJ.Host, to, SJ.Subject, SJ.Body, "html")
if err != nil {
msgbox.AppendText("\r\n失败:" + err.Error() + "\r\n")
if err.Error() == "550 Mailbox not found or access denied" {
SJ.Send = strings.Join(DelArrayVar(strings.Split(SJ.Send, "\r\n"), to), "\r\n")
es.SetText(SJ.Send)
}
time.Sleep(1 * time.Second)
continue
} else {
susscess++
msgbox.AppendText("\r\n发送成功!")
SJ.Send = strings.Join(DelArrayVar(strings.Split(SJ.Send, "\r\n"), to), "\r\n")
es.SetText(SJ.Send)
}
time.Sleep(1 * time.Second)
}
SaveData()
msgbox.AppendText("停止发送!成功 " + strconv.Itoa(susscess) + " 条\r\n")
}
示例3: main
func main() {
var aTE, bTE, cTE, dTE *walk.LineEdit
var outTE *walk.TextEdit
var mw *walk.MainWindow
defer func() {
if e := recover(); e != nil {
walk.MsgBox(mw, "Error", fmt.Sprintf("%v", e), walk.MsgBoxIconInformation)
}
}()
MainWindow{
AssignTo: &mw,
Title: "24 Game",
MinSize: Size{600, 400},
Layout: VBox{},
Children: []Widget{
Composite{
Layout: HBox{},
Children: []Widget{
Label{Text: "a"},
LineEdit{AssignTo: &aTE},
Label{Text: "b"},
LineEdit{AssignTo: &bTE},
Label{Text: "c"},
LineEdit{AssignTo: &cTE},
Label{Text: "d"},
LineEdit{AssignTo: &dTE},
PushButton{
Text: "Go",
OnClicked: func() {
rand.Seed(time.Now().Unix())
aTE.SetText(fmt.Sprint(rand.Intn(13) + 1))
bTE.SetText(fmt.Sprint(rand.Intn(13) + 1))
cTE.SetText(fmt.Sprint(rand.Intn(13) + 1))
dTE.SetText(fmt.Sprint(rand.Intn(13) + 1))
},
},
},
},
TextEdit{AssignTo: &outTE, ReadOnly: true},
PushButton{
Text: "Compute",
OnClicked: func() {
a, err := strconv.ParseInt(aTE.Text(), 10, 64)
b, err := strconv.ParseInt(bTE.Text(), 10, 64)
c, err := strconv.ParseInt(cTE.Text(), 10, 64)
d, err := strconv.ParseInt(dTE.Text(), 10, 64)
if err != nil {
walk.MsgBox(mw, "Error", err.Error(), walk.MsgBoxIconInformation)
}
outTE.SetText("")
for solution := range findSolution(a, b, c, d) {
outTE.AppendText(fmt.Sprintf("%s = 24\r\n", solution))
}
if outTE.Text() == "" {
outTE.SetText("No solution.")
}
},
},
},
}.Run()
}