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


Golang LineEdit.SetText方法代码示例

本文整理汇总了Golang中github.com/lxn/walk.LineEdit.SetText方法的典型用法代码示例。如果您正苦于以下问题:Golang LineEdit.SetText方法的具体用法?Golang LineEdit.SetText怎么用?Golang LineEdit.SetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/lxn/walk.LineEdit的用法示例。


在下文中一共展示了LineEdit.SetText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: showDialogAction_Triggered

func (mw *MyMainWindow) showDialogAction_Triggered() {
	dlg := new(MyDialog)

	var acceptPB *walk.PushButton
	var le1, le2 *walk.LineEdit

	widgets := []Widget{
		Label{Row: 0, Column: 0, Text: "A LineEdit:"},
		LineEdit{Row: 0, Column: 1, AssignTo: &le1, OnTextChanged: func() { le2.SetText(le1.Text()) }},
		ToolButton{Row: 0, Column: 2, Text: "..."},
		Label{Row: 1, Column: 0, Text: "Another LineEdit:"},
		LineEdit{Row: 1, Column: 1, AssignTo: &le2},
		Label{Row: 2, Column: 0, Text: "A ComboBox:"},
		ComboBox{Row: 2, Column: 1},
		VSpacer{Row: 3, Column: 0, Size: 10},
		Label{Row: 4, Column: 0, ColumnSpan: 2, Text: "A TextEdit:"},
		TextEdit{Row: 5, Column: 0, ColumnSpan: 2},
	}

	dd := &DialogDecl{
		Title:    "My Dialog",
		Owner:    mw,
		Dialog:   &dlg.Dialog,
		AcceptPB: &acceptPB,
		Widgets:  widgets,
		MinSize:  Size{400, 300},
	}

	if err := dd.Create(); err != nil {
		log.Fatal(err)
	}

	acceptPB.Clicked().Attach(func() {
		dlg.Accept()
	})

	dlg.Run()
}
开发者ID:etel,项目名称:walk,代码行数:38,代码来源:declarative.go

示例2: 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

示例3: CreateVersion_Triggered

/**
 *添加版本的方法
 */
func CreateVersion_Triggered(owner walk.Form, model *xorm.VersionModel) {
	var dlg *walk.Dialog
	var db *walk.DataBinder
	var dph *walk.LineEdit
	var ep walk.ErrorPresenter
	var version = new(xorm.Version)
	var acceptPB, cancelPB *walk.PushButton

	var dialog = Dialog{}
	dialog.AssignTo = &dlg
	dialog.Title = "创建版本"
	dialog.DataBinder = DataBinder{
		AssignTo:       &db,
		DataSource:     version,
		ErrorPresenter: ErrorPresenterRef{&ep},
	}
	dialog.MinSize = Size{300, 200}
	dialog.Layout = VBox{}
	dialog.DefaultButton = &acceptPB
	dialog.CancelButton = &cancelPB
	dirPath := LineEdit{
		AssignTo: &dph,
		Text:     Bind("Path"),
		ReadOnly: true,
	}

	childrens := []Widget{
		Composite{
			Layout: Grid{Columns: 5},
			Children: []Widget{
				Label{
					Text:    "工程:",
					MinSize: Size{42, 0},
				},
				ComboBox{
					MinSize:       Size{108, 0},
					Value:         Bind("ProjectName", SelRequired{}),
					BindingMember: "Key",
					DisplayMember: "Name",
					Model:         xorm.FindAllProjDataCombox(),
				},
				dirPath,
				PushButton{
					Text: "选择版本",
					OnClicked: func() {
						filDlg := new(walk.FileDialog)
						filDlg.ShowBrowseFolder(owner)
						dph.SetText(filDlg.FilePath)
					},
				},
			},
		},
		Composite{
			Layout: Grid{Columns: 2},
			Children: []Widget{
				Label{
					Text: "名称:",
				},
				LineEdit{
					Text:      Bind("Name"),
					MaxLength: 10,
				},
				Label{
					Text: "创建者:",
				},
				LineEdit{
					Text:      Bind("CreateUser"),
					MaxLength: 10,
				},
				Label{
					Text: "描述:",
				},
				TextEdit{
					Text:    Bind("Desc"),
					MinSize: Size{300, 50},
				},
				LineErrorPresenter{
					AssignTo:   &ep,
					ColumnSpan: 2,
				},
			},
		},
		Composite{
			Layout: HBox{},
			Children: []Widget{
				HSpacer{},
				PushButton{
					AssignTo: &acceptPB,
					Text:     "保存",
					OnClicked: func() {
						if err := db.Submit(); err != nil {
							log.Print(err)
							return
						}
						xorm.SaveVersionByParam(version.Name, version.CreateUser, version.Desc)
						model.ResetRows()
						dlg.Accept()
//.........这里部分代码省略.........
开发者ID:starmoonlove,项目名称:packutil,代码行数:101,代码来源:versionview.go


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