当前位置: 首页>>代码示例>>Golang>>正文


Golang TextEdit.AppendText方法代码示例

本文整理汇总了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()
}
开发者ID:yukitori,项目名称:soramail,代码行数:42,代码来源:main.go

示例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")
}
开发者ID:gwenlei,项目名称:gotest,代码行数:29,代码来源:walk.go

示例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()
}
开发者ID:J-F-Liu,项目名称:24Point,代码行数:63,代码来源:main.go


注:本文中的github.com/lxn/walk.TextEdit.AppendText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。