• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang walk.PushButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

// Main entry and GUI construction
func main() {
	LANG = queryRegLayoutId(LANG_ID)
	var (
		mw            *walk.MainWindow
		currentLayout = getKeyboardLayout() // Get current system layout.
		layoutPresent = checkLanguage()     // Check if installed language is present and can be loaded.
		triggered     = true
		infoText      string
		ldtMain       *walk.LineEdit
		btnMain       *walk.PushButton
	)

	if layoutPresent {
		infoText = INFO_TEXT
	} else {
		infoText = "The layout does not seem to be present on your system. Please install it first."
	}

	MainWindow{
		AssignTo: &mw,
		Title:    "kasahorow " + LANG_STRING + " Writer",
		MaxSize:  Size{600, 200},
		MinSize:  Size{600, 200},
		Layout:   VBox{},
		Children: []Widget{
			MultilineLabel{Text: infoText},
			LineEdit{AssignTo: &ldtMain},
			PushButton{
				AssignTo: &btnMain,
				Enabled:  layoutPresent,
				Text:     "Switch back to default layout.",
				OnClicked: func() {
					if triggered {
						triggered = false
						activateKeyboardLayout(currentLayout, KFL_SETFORPROCESS)
						btnMain.SetText("Switch to " + LANG_STRING + ".")
					} else {
						triggered = true
						loadLanguage()
						btnMain.SetText("Switch back to default layout.")
					}
				},
			},
		},
	}.Create()

	if layoutPresent {
		mw.Synchronize(loadLanguage) // Load new layout in main GUI thread.
	}

	ic, _ := walk.NewIconFromResource("kasahorow")
	mw.SetIcon(ic)
	mw.Run()
}
开发者ID:amonmoce,项目名称:africakeyboards,代码行数:55,代码来源:keyboard.go


示例2: main

func main() {
	LoadData()
	chEnd = make(chan bool)
	var emails, body, msgbox *walk.TextEdit
	var user, password, host, subject *walk.LineEdit
	var startBtn *walk.PushButton
	MainWindow{
		Title:   "邮件群发器 By 一曲忧伤",
		MinSize: Size{800, 600},
		Layout:  HBox{},
		Children: []Widget{
			TextEdit{AssignTo: &emails, Text: SJ.Send, ToolTipText: "待发送邮件列表,每行一个"},
			VSplitter{
				Children: []Widget{
					LineEdit{AssignTo: &user, Text: SJ.Name, CueBanner: "请输入邮箱用户名"},
					LineEdit{AssignTo: &password, Text: SJ.Pwd, PasswordMode: true, CueBanner: "请输入邮箱登录密码"},
					LineEdit{AssignTo: &host, Text: SJ.Host, CueBanner: "SMTP服务器:端口"},
					LineEdit{AssignTo: &subject, Text: SJ.Subject, CueBanner: "请输入邮件主题……"},
					TextEdit{AssignTo: &body, Text: SJ.Body, ToolTipText: "请输入邮件内容", ColumnSpan: 2},
					TextEdit{AssignTo: &msgbox, ReadOnly: true},
					PushButton{
						AssignTo: &startBtn,
						Text:     "开始群发",
						OnClicked: func() {
							SJ.Name = user.Text()
							SJ.Pwd = password.Text()
							SJ.Host = host.Text()
							SJ.Subject = subject.Text()
							SJ.Body = body.Text()
							SJ.Send = emails.Text()
							SaveData()

							if runing == false {
								runing = true
								startBtn.SetText("停止发送")
								go sendThread(msgbox, emails)
							} else {
								runing = false
								startBtn.SetText("开始群发")
							}
						},
					},
				},
			},
		},
	}.Run()
}
开发者ID:gwenlei,项目名称:gotest,代码行数:47,代码来源:walk.go


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


示例4: main

func main() {
	fout, _ := os.Create("dialer.log")
	defer fout.Close()
	bo := bufio.NewWriter(fout)
	defer bo.Flush()
	util.INFO.SetOutput(bo)
	util.ERROR.SetOutput(bo)

	bin, err := ioutil.ReadFile("config.json")
	if err == nil {
		json.Unmarshal(bin, config)
	} else {
		util.ERROR.Log(err)
		err = nil
	}

	var usr, pwd *walk.LineEdit
	var raddr, rusr, rpwd *walk.LineEdit
	var lb, rb *walk.PushButton
	var mode *walk.ComboBox
	var mw *walk.MainWindow
	var db *walk.DataBinder
	var laddr, lusr, lpwd *walk.Splitter
	go func() {
		for mw == nil {
			runtime.Gosched()
		}
		ic, err := walk.NewIconFromResourceId(6)
		if err == nil {
			// func onLoad() {
			db.SetAutoSubmit(true)
			mw.SetIcon(ic)
			switch config.RouterType {
			case "hiwifi":
				laddr.SetVisible(true)
				lusr.SetVisible(false)
				lpwd.SetVisible(true)
			case "openwrt":
				laddr.SetVisible(true)
				lusr.SetVisible(true)
				lpwd.SetVisible(true)
			case "asus":
				laddr.SetVisible(true)
				lusr.SetVisible(true)
				lpwd.SetVisible(true)
			default:
				laddr.SetVisible(false)
				lusr.SetVisible(false)
				lpwd.SetVisible(false)
			}
			mw.SetSize(walk.Size{0, 0})
			// }
		}
	}()
	MainWindow{
		AssignTo: &mw,
		Title:    TITLE,
		MinSize:  Size{340, 0},
		Layout:   VBox{},
		DataBinder: DataBinder{
			AssignTo:   &db,
			DataSource: config,
		},
		Children: []Widget{
			HSplitter{
				Children: []Widget{
					Label{Text: "用户名", MaxSize: Size{60, 20}},
					LineEdit{Text: Bind("Username"), AssignTo: &usr, MaxSize: Size{0, 20}},
				}, MaxSize: Size{0, 20},
			},
			HSplitter{
				Children: []Widget{
					Label{Text: "密码", MaxSize: Size{60, 20}},
					LineEdit{Text: Bind("Password"), AssignTo: &pwd, MaxSize: Size{0, 20}, PasswordMode: true,
						OnMouseDown: func(x, y int, button walk.MouseButton) {
							pwd.SetPasswordMode(false)
						},
						OnMouseUp: func(x, y int, button walk.MouseButton) {
							pwd.SetPasswordMode(true)
						},
					},
				}, MaxSize: Size{0, 20},
			},
			HSplitter{
				Children: []Widget{
					Label{Text: "模式", MaxSize: Size{60, 20}},
					ComboBox{AssignTo: &mode,
						Editable: true, Value: Bind("RouterType"),
						Model:   []string{"local", "10.0.x.x(手动填写)", "openwrt", "hiwifi", "asus"},
						MaxSize: Size{0, 20},
						OnCurrentIndexChanged: func() {
							switch mode.CurrentIndex() {
							case 2: //"openwrt":
								laddr.SetVisible(true)
								lusr.SetVisible(true)
								lpwd.SetVisible(true)
							case 3: //"hiwifi":
								config.RouterAddr = "192.168.199.1"
								laddr.SetVisible(true)
								lusr.SetVisible(false)
//.........这里部分代码省略.........
开发者ID:pa001024,项目名称:netdialer,代码行数:101,代码来源:gui.go


示例5: main

func main() {
	mw := new(MyMainWindow)
	var openButton *walk.PushButton
	var hostEdit, destEdit, portEdit *walk.LineEdit
	var logTextEdit *walk.TextEdit
	closeMessage := make(chan int)

	MainWindow{
		AssignTo: &mw.MainWindow,
		Title:    "SCREAMO",
		MinSize:  Size{600, 400},
		Layout:   VBox{},
		Children: []Widget{
			Composite{
				Layout: Grid{},
				Children: []Widget{
					Label{
						Row:    0,
						Column: 0,
						Text:   "JmsHost:",
					},
					LineEdit{
						AssignTo: &hostEdit,
						Row:      0,
						Column:   1,
						Text:     "192.168.1.105",
					},
					Label{
						Row:    1,
						Column: 0,
						Text:   "JmsDest:",
					},
					LineEdit{
						AssignTo: &destEdit,
						Row:      1,
						Column:   1,
						Text:     "/topic/IDC.QuoteExchange.bond2app",
					},
					Label{
						Row:    2,
						Column: 0,
						Text:   "JmsPort:",
					},
					LineEdit{
						AssignTo: &portEdit,
						Row:      2,
						Column:   1,
						Text:     "61612",
					},
				},
			},

			Composite{
				Layout: HBox{},
				Children: []Widget{
					PushButton{
						AssignTo: &openButton,
						Text:     "Open",
						OnClicked: func() {
							if openButton.Text() == "Open" {
								go openstomp(hostEdit.Text(), destEdit.Text(), portEdit.Text(), logTextEdit, closeMessage)
								openButton.SetText("Close")
							} else {
								go stopstomp(closeMessage)
								openButton.SetText("Open")
							}
						},
					},
					PushButton{
						Text: "Clear",
						OnClicked: func() {
							logTextEdit.SetText("")
						},
					},
				},
			},

			TextEdit{
				AssignTo: &logTextEdit,
				MinSize:  Size{100, 50},
				Text:     "",
				ReadOnly: true,
			},
		},
	}.Run()
}
开发者ID:chinab,项目名称:enterprise-manage,代码行数:86,代码来源:patrtest.go


示例6: main

func main() {
	MustRegisterCondition("isSpecialMode", isSpecialMode)

	mw := new(MyMainWindow)

	var openAction, showAboutBoxAction *walk.Action
	var recentMenu *walk.Menu
	var toggleSpecialModePB *walk.PushButton

	if err := (MainWindow{
		AssignTo: &mw.MainWindow,
		Title:    "Walk Actions Example",
		MenuItems: []MenuItem{
			Menu{
				Text: "&File",
				Items: []MenuItem{
					Action{
						AssignTo:    &openAction,
						Text:        "&Open",
						Image:       "../img/open.png",
						Enabled:     Bind("enabledCB.Checked"),
						Visible:     Bind("openVisibleCB.Checked"),
						Shortcut:    Shortcut{walk.ModControl, walk.KeyO},
						OnTriggered: mw.openAction_Triggered,
					},
					Menu{
						AssignTo: &recentMenu,
						Text:     "Recent",
					},
					Separator{},
					Action{
						Text:        "E&xit",
						OnTriggered: func() { mw.Close() },
					},
				},
			},
			Menu{
				Text: "&Help",
				Items: []MenuItem{
					Action{
						AssignTo:    &showAboutBoxAction,
						Text:        "About",
						OnTriggered: mw.showAboutBoxAction_Triggered,
					},
				},
			},
		},
		ToolBarItems: []MenuItem{
			ActionRef{&openAction},
			Menu{
				Text:  "New A",
				Image: "../img/document-new.png",
				Items: []MenuItem{
					Action{
						Text:        "A",
						OnTriggered: mw.newAction_Triggered,
					},
					Action{
						Text:        "B",
						OnTriggered: mw.newAction_Triggered,
					},
					Action{
						Text:        "C",
						OnTriggered: mw.newAction_Triggered,
					},
				},
				OnTriggered: mw.newAction_Triggered,
			},
			Separator{},
			Menu{
				Text:  "View",
				Image: "../img/document-properties.png",
				Items: []MenuItem{
					Action{
						Text:        "X",
						OnTriggered: mw.changeViewAction_Triggered,
					},
					Action{
						Text:        "Y",
						OnTriggered: mw.changeViewAction_Triggered,
					},
					Action{
						Text:        "Z",
						OnTriggered: mw.changeViewAction_Triggered,
					},
				},
			},
			Separator{},
			Action{
				Text:        "Special",
				Image:       "../img/system-shutdown.png",
				Enabled:     Bind("isSpecialMode && enabledCB.Checked"),
				OnTriggered: mw.specialAction_Triggered,
			},
		},
		ContextMenuItems: []MenuItem{
			ActionRef{&showAboutBoxAction},
		},
		MinSize: Size{300, 200},
		Layout:  VBox{},
//.........这里部分代码省略.........
开发者ID:2105666566,项目名称:walk,代码行数:101,代码来源:actions.go


示例7: main

func main() {
	LoadData()
	chEnd = make(chan bool)
	var emails, body, msgbox *walk.TextEdit
	var user, password, host, subject *walk.LineEdit
	var db *walk.DataBinder
	var ep walk.ErrorPresenter
	var startBtn *walk.PushButton
	mw := new(MyMainWindow)
	mw.SetFixedSize(false)
	mw.SetMaximizeBox(false)

	MainWindow{
		Title:    "邮件群发器 By 一曲忧伤",
		MinSize:  Size{300, 200},
		AssignTo: &mw.MainWindow,
		DataBinder: DataBinder{
			AssignTo:       &db,
			DataSource:     SJ,
			ErrorPresenter: ErrorPresenterRef{&ep},
		},
		ScreenCenter: true,
		Layout:       HBox{},
		Children: []Widget{
			TextEdit{
				AssignTo:    &emails,
				Text:        SJ.Send,
				ToolTipText: "待发送邮件列表,每行一个",
			},

			VSplitter{
				Children: []Widget{
					LineEdit{
						AssignTo:  &user,
						Text:      Bind(SJ.Name, Regexp{"^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"}),
						CueBanner: "请输入邮箱用户名",
					},
					LineEdit{
						AssignTo:     &password,
						Text:         SJ.Pwd,
						PasswordMode: true,
						CueBanner:    "请输入邮箱登录密码",
					},
					LineEdit{
						AssignTo:  &host,
						Text:      Bind(SJ.Host, Regexp{"^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$"}),
						CueBanner: "SMTP服务器:端口",
					},
					LineEdit{AssignTo: &subject,
						MaxLength: 10,
						Text:      Bind(SJ.Subject, Regexp{"^([a-z0-9A-Z])+$"}),
						CueBanner: "请输入邮件主题……",
					},
					TextEdit{AssignTo: &body,
						Text:        Bind(SJ.Body, SelRequired{}),
						ToolTipText: "请输入邮件内容",
						ColumnSpan:  2,
					},
					TextEdit{AssignTo: &msgbox,
						ReadOnly: true,
					},
					LineErrorPresenter{
						AssignTo:    &ep,
						ColumnSpan:  2,
						ToolTipText: "测试",
					},
					PushButton{
						AssignTo: &startBtn,
						Text:     "开始群发",
						OnClicked: func() {
							if err := db.Submit(); err == nil {
								SJ.Name = user.Text()
								SJ.Pwd = password.Text()
								SJ.Host = host.Text()
								SJ.Subject = subject.Text()
								SJ.Body = body.Text()
								SJ.Send = emails.Text()
								SaveData()

								if runing == false {
									runing = true
									startBtn.SetText("停止发送")
									go sendThread(msgbox, emails)
								} else {
									runing = false
									startBtn.SetText("开始群发")
								}
							} else {
								return
							}

						},
					},
				},
			},
		},
	}.Run()
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:98,代码来源:main.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang walk.TableView类代码示例发布时间:2022-05-23
下一篇:
Golang walk.Menu类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap