本文整理汇总了Golang中github.com/lxn/walk.FileDialog.Title方法的典型用法代码示例。如果您正苦于以下问题:Golang FileDialog.Title方法的具体用法?Golang FileDialog.Title怎么用?Golang FileDialog.Title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxn/walk.FileDialog
的用法示例。
在下文中一共展示了FileDialog.Title方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: openFileDia
// real open file dialog
func (tmw *TaxMainWindow) openFileDia() error {
dlg := new(walk.FileDialog)
dlg.FilePath = tmw.prevFilePath
dlg.Filter = "Excel Files(*.xls;*.xlsx)|*.xls;*.xlsx"
dlg.Title = "请选择Excel文件"
if ok, err := dlg.ShowOpen(tmw); err != nil {
return err
} else if !ok {
return nil
}
// 拿到选择的文件的路径放入tmw struct
tmw.prevFilePath = dlg.FilePath
fmt.Println(tmw.prevFilePath)
// pre clear data
truncateData(vatTable)
// invoke taxxlsx read and save 2 db
if iSuc := xls.ReadAndSave(tmw.prevFilePath); iSuc {
walk.MsgBox(tmw, "成功", "导入成功", walk.MsgBoxIconInformation)
// 显示默认列表数据
model.RestRows(defaDisplayData())
}
return nil
}
示例2: openFile
func (mw *MyDialog) openFile(filetype string) (file string, err error) {
dlgFile := new(walk.FileDialog)
switch filetype {
case "PC助手":
dlgFile.Filter = "PC助手(*.exe)|*.exe"
dlgFile.Title = "选择PC助手"
case "Android助手":
dlgFile.Filter = "Android助手(*.apk)|*.apk"
dlgFile.Title = "选择Android助手"
case "Web 数据库":
dlgFile.Filter = "Web 数据库(*.sql)|*.sql"
dlgFile.Title = "选择Web 数据库"
}
if ok, err := dlgFile.ShowOpen(mw); err != nil {
return dlgFile.FilePath, err
} else if !ok {
return dlgFile.FilePath, err
}
file = dlgFile.FilePath
return file, nil
}
示例3: openImage
func (mw *MyMainWindow) openImage() error {
dlg := new(walk.FileDialog)
dlg.FilePath = mw.prevFilePath
dlg.Filter = "Image Files (*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff)|*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff"
dlg.Title = "Select an Image"
if ok, err := dlg.ShowOpen(mw); err != nil {
return err
} else if !ok {
return nil
}
mw.prevFilePath = dlg.FilePath
img, err := walk.NewImageFromFile(dlg.FilePath)
if err != nil {
return err
}
var succeeded bool
defer func() {
if !succeeded {
img.Dispose()
}
}()
page, err := walk.NewTabPage()
if err != nil {
return err
}
if page.SetTitle(path.Base(strings.Replace(dlg.FilePath, "\\", "/", -1))); err != nil {
return err
}
示例4: 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()
}
示例5: browser
// 浏览升级包
func (mw *MyWindow) browser() {
fd := new(walk.FileDialog)
fd.Title = "选择iMan升级包"
fd.Filter = "iMan Files 最大200MB|*"
fd.FilePath = mw.file
if _, err := fd.ShowOpen(mw); err != nil {
log.Fatal(err)
}
mw.file = fd.FilePath
}
示例6: openImage
func (mw *MyMainWindow) openImage() error {
dlg := new(walk.FileDialog)
dlg.FilePath = mw.prevFilePath
dlg.Filter = "Image Files (*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff)|*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff"
dlg.Title = "选择图片"
if ok, err := dlg.ShowOpen(mw); err != nil {
return err
} else if !ok {
return nil
}
mw.prevFilePath = dlg.FilePath
return nil
}
示例7: openFile
func (mw *MyDialog) openFile() error {
dlgFile := new(walk.FileDialog)
dlgFile.FilePath = mw.upgrideFile
dlgFile.Filter = "iMan Files 最大200MB|*"
dlgFile.Title = "选择iMan升级包"
if ok, err := dlgFile.ShowOpen(mw); err != nil {
return err
} else if !ok {
return nil
}
mw.upgrideFile = dlgFile.FilePath
return nil
}
示例8: openFile
func (mw *MyDialog) openFile() error {
dlgFile := new(walk.FileDialog)
dlgFile.FilePath = mw.adjFile
dlgFile.Filter = "附件 (*)|*"
dlgFile.Title = "选择附件"
if ok, err := dlgFile.ShowOpen(mw); err != nil {
return err
} else if !ok {
return nil
}
mw.adjFile = dlgFile.FilePath
return nil
}
示例9: showImage
func showImage(owner walk.Form, tabWidget *walk.TabWidget) {
dlgf := new(walk.FileDialog)
dlgf.FilePath = ""
dlgf.Filter = "Image Files (*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff)|*.emf;*.bmp;*.exif;*.gif;*.jpeg;*.jpg;*.png;*.tiff"
dlgf.Title = "Select an Image"
if ok, err := dlgf.ShowOpen(owner); err != nil {
log.Print(err)
} else if !ok {
//return nil
}
//walk.MsgBox(nil, "文件路径", dlgf.FilePath, walk.MsgBoxOK)
img, err := walk.NewImageFromFile(dlgf.FilePath)
if err != nil {
log.Print(err)
}
var succeeded bool
defer func() {
if !succeeded {
img.Dispose()
}
}()
page, err := walk.NewTabPage()
if err != nil {
log.Print(err)
}
//if page.SetTitle(path.Base(strings.Replace(dlgf.FilePath, "\\", "/", -1))); err != nil {
// log.Print(err)
//}
page.SetLayout(walk.NewHBoxLayout())
defer func() {
if !succeeded {
page.Dispose()
}
}()
imageView, err := walk.NewImageView(page)
if err != nil {
log.Print(err)
}
defer func() {
if !succeeded {
imageView.Dispose()
}
}()
imageView.SetImage(img)
if err := tabWidget.Pages().Add(page); err != nil {
log.Print(err)
}
if err := tabWidget.SetCurrentIndex(tabWidget.Pages().Len() - 1); err != nil {
log.Print(err)
}
succeeded = true
}