本文整理汇总了Golang中github.com/lxn/walk.TextEdit类的典型用法代码示例。如果您正苦于以下问题:Golang TextEdit类的具体用法?Golang TextEdit怎么用?Golang TextEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEdit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var mw *walk.MainWindow
var outTE *walk.TextEdit
animal := new(Animal)
if _, err := (MainWindow{
AssignTo: &mw,
Title: "Walk Data Binding Example",
MinSize: Size{300, 200},
Layout: VBox{},
Children: []Widget{
PushButton{
Text: "Edit Animal",
OnClicked: func() {
if cmd, err := RunAnimalDialog(mw, animal); err != nil {
log.Print(err)
} else if cmd == walk.DlgCmdOK {
outTE.SetText(fmt.Sprintf("%+v", animal))
}
},
},
Label{
Text: "animal:",
},
TextEdit{
AssignTo: &outTE,
ReadOnly: true,
Text: fmt.Sprintf("%+v", animal),
},
},
}.Run()); err != nil {
log.Fatal(err)
}
}
开发者ID:Fruchtgummi,项目名称:walk,代码行数:35,代码来源:databinding.go
示例2: main
func main() {
var outTE *walk.TextEdit
mw := new(MyMainWindow)
MainWindow{
Title: "简易加密文件",
AssignTo: &mw.MainWindow,
MinSize: Size{300, 140},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "选择文件求反",
OnClicked: func() {
dlg := new(walk.FileDialog)
dlg.Title = "选择文件"
if ok, err := dlg.ShowOpen(mw); err != nil {
outTE.SetText(err.Error())
} else if !ok {
outTE.SetText("未选择文件")
} else {
fileName := dlg.FilePath
file, err := os.Open(fileName)
defer file.Close()
if err != nil {
outTE.SetText("未找到待处理文件")
}
//读取文件内容
plain, _ := ioutil.ReadAll(file)
//求反
for i, b := range plain {
plain[i] = ^b
}
//写入文件
if fileName[len(fileName)-1:] != "+" {
fileName += "+"
} else {
fileName = fileName[:len(fileName)-1]
}
err = ioutil.WriteFile(fileName, plain, 0777)
if err != nil {
outTE.SetText(dlg.FilePath + " 保存转换后文件失败!")
} else {
outTE.SetText(dlg.FilePath + " 文件已转换!")
}
}
},
},
},
}.Run()
}
开发者ID:duomi520,项目名称:wswFileTakeBack,代码行数:54,代码来源:main.go
示例3: main
func main() {
var te *walk.TextEdit
if _, err := (MainWindow{
Title: "Walk Clipboard Example",
MinSize: Size{300, 200},
Layout: VBox{},
Children: []Widget{
PushButton{
Text: "Copy",
OnClicked: func() {
if err := walk.Clipboard().SetText(te.Text()); err != nil {
log.Print("Copy: ", err)
}
},
},
PushButton{
Text: "Paste",
OnClicked: func() {
if text, err := walk.Clipboard().Text(); err != nil {
log.Print("Paste: ", err)
} else {
te.SetText(text)
}
},
},
TextEdit{
AssignTo: &te,
},
},
}).Run(); err != nil {
log.Fatal(err)
}
}
开发者ID:2105666566,项目名称:walk,代码行数:34,代码来源:clipboard.go
示例4: openstomp
func openstomp(host, dest, port string, logTextEdit *walk.TextEdit, closeMessage chan int) {
stomputils.JmsHost = host
stomputils.JmsDest = dest
stomputils.JmsPort = port
handleMessage := func(body []byte) {
//fmt.Println(string(body))
logTextEdit.SetText(logTextEdit.Text() + string(body))
}
stomputils.Handle(handleMessage, closeMessage)
}
开发者ID:chinab,项目名称:enterprise-manage,代码行数:12,代码来源:patrtest.go
示例5: main
func main() {
var textEdit *walk.TextEdit
MainWindow{
Title: "Walk DropFiles Example",
MinSize: Size{320, 240},
Layout: VBox{},
OnDropFiles: func(files []string) {
textEdit.SetText(strings.Join(files, "\r\n"))
},
Children: []Widget{
TextEdit{
AssignTo: &textEdit,
ReadOnly: true,
Text: "Drop files here, from windows explorer...",
},
},
}.Run()
}
开发者ID:Fruchtgummi,项目名称:walk,代码行数:18,代码来源:dropfiles.go
示例6: 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
示例7: main
func main() {
var inTE, outTE *walk.TextEdit
MainWindow{
Title: "PHP Interpreter",
MinSize: Size{600, 400},
Layout: VBox{},
Children: []Widget{
Label{
Text: "Escriba codigo PHP sin etiquetas de <?php apertura y cierre ?>",
},
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "Let the magic happen!",
OnClicked: func() {
input := strings.Replace(inTE.Text(), "\n", " ", -1)
out, err := exec.Command("php", "-r", input).Output()
if err != nil {
log.Println(err)
}
outTE.SetText(string(out))
},
},
},
}.Run()
}
开发者ID:nbpalomino,项目名称:PHP_InterpreterGUI,代码行数:34,代码来源:win7.go
示例8: main
func main() {
var (
te *walk.TextEdit
le *walk.LineEdit
)
MainWindow{
Title: _WIN_TITLE,
MinSize: Size{300, 400},
Layout: VBox{},
Children: []Widget{
Label{
Text: _WIN_LABEL_HOST,
},
LineEdit{
AssignTo: &le,
Text: GetHttpHost(),
},
Label{
Text: _WIN_LABEL_LINK,
},
TextEdit{
AssignTo: &te,
},
Composite{
Layout: HBox{},
Children: []Widget{
PushButton{
Text: _WIN_GEN_BUTTON,
OnClicked: func() {
URL, err := url.Parse(te.Text())
if err != nil {
return
}
genURL := generateURL(URL, le.Text())
if genURL != nil {
te.SetText(genURL.String())
}
},
},
PushButton{
Text: _WIN_COPY_BUTTON,
OnClicked: func() {
walk.Clipboard().SetText(te.Text())
},
},
},
},
},
}.Run()
}
开发者ID:ivan1993spb,项目名称:ru-supplier,代码行数:52,代码来源:windows.go
示例9: 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
示例10: main
func main() {
var inTE, outTE *walk.TextEdit
MainWindow{
Title: "SCREAMO",
MinSize: Size{600, 400},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "SCREAM",
OnClicked: func() {
outTE.SetText(strings.ToUpper(inTE.Text()))
},
},
},
}.Run()
}
开发者ID:axlrose,项目名称:golang_samples,代码行数:23,代码来源:testwin32.go
示例11: 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
示例12: main
//please check intel host bridge for PCIEBAR (0:0:0:60)
//usualy it's 0xE0000000
func main() {
var Busno, Devno, Funcno, Regno, outTE *walk.TextEdit
PCIEBAR := 14
MainWindow{
Title: "PCI address Calculator",
MinSize: Size{500, 150},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
Label{Text: "Bus:"},
TextEdit{
AssignTo: &Busno,
},
Label{Text: "Dev:"},
TextEdit{
AssignTo: &Devno,
},
Label{Text: "Func:"},
TextEdit{
AssignTo: &Funcno,
},
Label{Text: "Reg:"},
TextEdit{
AssignTo: &Regno,
},
PushButton{
Text: "Get",
OnClicked: func() {
BB, _ := strconv.Atoi(Busno.Text())
DD, _ := strconv.Atoi(Devno.Text())
FF, _ := strconv.Atoi(Funcno.Text())
RR, _ := strconv.Atoi(Regno.Text())
pcimmaddr := PCIEBAR<<28 + BB<<20 + DD<<15 + FF<<12 + (RR & 0xfc)
pciaddr := 1<<31 + BB<<16 + DD<<11 + FF<<8 + (RR & 0xfc)
outTE.SetText(fmt.Sprintf("pci io address: %X\r\npci mmio address: %X", pciaddr, pcimmaddr))
},
},
},
},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
}.Run()
}
开发者ID:kurtqiao,项目名称:go,代码行数:46,代码来源:calpciGUI.go
示例13: 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
示例14: 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
示例15: 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.TextEdit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论