本文整理汇总了Golang中github.com/lxn/walk.MsgBox函数的典型用法代码示例。如果您正苦于以下问题:Golang MsgBox函数的具体用法?Golang MsgBox怎么用?Golang MsgBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MsgBox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DeleteVariable
func DeleteVariable(mw *walk.MainWindow, m *env.Model, name string) {
if win.IDYES == walk.MsgBox(mw, "Information", "You want to delete variable "+name, walk.MsgBoxYesNo) {
if !m.DeleteVariable(name) {
walk.MsgBox(mw, "Error", "Please ensure the variable has already existed.", walk.MsgBoxOK)
}
}
}
示例3: OpenAdmin
func (mw *MyWindow) OpenAdmin() {
if mw.urlIP == "" {
walk.MsgBox(mw, "提示信息", "请先点击切换IP,再点击打开后台管理页面按钮。", walk.MsgBoxIconInformation)
return
}
url := fmt.Sprintf("http://%s/admin", mw.urlIP)
if mw.urlIP == "114.114.114.114" {
url = "http://www.baidu.com"
}
walk.MsgBox(mw, "提示信息", fmt.Sprintf("正在尝试打开管理后台:%s,请耐心等待!", url), walk.MsgBoxIconInformation)
for mw.ok {
url = fmt.Sprintf("http://%s/admin", mw.urlIP)
if mw.urlIP == "114.114.114.114" {
url = "http://www.baidu.com"
}
info := fmt.Sprintf("%s正在尝试打开管理后台: %s\n", INFO, url)
mw.lv.PostAppendText(info)
resp, err := http.Get(url)
if err != nil {
time.Sleep(3 * time.Second)
continue
}
if resp.StatusCode == http.StatusOK {
cmd := fmt.Sprintf("cmd /k start %s", url)
mw.iman.DoCmd(cmd)
mw.iman.Run()
resp.Body.Close()
walk.MsgBox(mw, "提示信息", "服务器连接正常,可通过浏览器进行管理!", walk.MsgBoxIconWarning)
return
}
resp.Body.Close()
}
}
示例4: ApplyEnv
func ApplyEnv(mw *walk.MainWindow, usrModel *env.Model, sysModel *env.Model) bool {
if err := usrModel.Apply(); err != nil {
walk.MsgBox(mw, "Error", fmt.Sprintf("%s", err), walk.MsgBoxOK)
return false
}
if err := sysModel.Apply(); err != nil {
walk.MsgBox(mw, "Error", fmt.Sprintf("%s", err), walk.MsgBoxOK)
return false
}
return true
}
示例5: CreateProj_Query
/**
** 查看所有项目的方法
**/
func CreateProj_Query(owner walk.Form) {
var dlg *walk.Dialog
var tv *walk.TableView
var dialog = Dialog{}
model := xorm.NewProjectModel()
dialog.AssignTo = &dlg
dialog.Title = "项目管理"
dialog.Layout = VBox{}
dialog.MinSize = Size{650, 300}
dialog.Children = []Widget{
TableView{
AssignTo: &tv,
AlternatingRowBGColor: walk.RGB(255, 255, 224),
ColumnsOrderable: true,
Columns: []TableViewColumn{
{Title: "编号", Width: 50},
{Title: "名称"},
{Title: "创建者"},
{Title: "创建时间", Format: "2006-01-02 15:04:05", Width: 130},
{Title: "描述", Width: 200},
},
Model: model,
},
Composite{
Layout: HBox{},
Children: []Widget{
HSpacer{},
PushButton{
Text: "创建",
OnClicked: func() {
CreateProj_Triggered(owner, model)
},
},
PushButton{
Text: "删除",
OnClicked: func() {
indexs := tv.SelectedIndexes()
if indexs.Len() == 0 {
walk.MsgBox(owner, "提示", "请选择要删除的数据", walk.MsgBoxIconError)
return
}
walk.MsgBox(owner, "提示", "确认是否删除此工程", walk.MsgBoxOKCancel)
obj := model.GetItemByindex(int64(indexs.At(0)))
xorm.DeleteProjectByObj(obj)
model.ResetRows()
},
},
},
},
}
dialog.Run(owner)
}
示例6: EditVariable
func EditVariable(mw *walk.MainWindow, m *env.Model, name string, value string) {
if ret, newName, newValue := ShowDialog(mw, name, value); ret == 0 {
if newName != name {
walk.MsgBox(mw, "Error", "You can't change the variable name when editing.", walk.MsgBoxOK)
return
}
if !m.EditVariable(name, newValue) {
walk.MsgBox(mw, "Error", "Please ensure the variable has already existed.", walk.MsgBoxOK)
return
}
}
}
示例7: openAddd_Triggered
func (mw *MyMainWindow) openAddd_Triggered() {
fmt.Println(mw.Size())
if err := db.Submit(); err != nil {
log.Println(err)
walk.MsgBox(mw, "错误提示", err.Error(), walk.MsgBoxIconError)
return
}
UserConfig.SaveConfig()
walk.MsgBox(mw, "提示信息", "保存用户成功.", walk.MsgBoxIconInformation)
}
示例8: msg
func (mw *MyWindow) msg(level, message string) {
switch level {
case "INFO":
walk.MsgBox(mw, "提示信息", message, walk.MsgBoxIconInformation)
log.Printf("%s\n", message)
case "DEBUG":
walk.MsgBox(mw, "警告信息", message, walk.MsgBoxIconWarning)
log.Printf("%s\n", message)
case "ERROR":
walk.MsgBox(mw, "错误信息", message, walk.MsgBoxIconError)
log.Printf("%s\n", message)
}
}
示例9: NewVariable
func NewVariable(mw *walk.MainWindow, m *env.Model) {
if ret, name, value := ShowDialog(mw, "", ""); ret == 0 {
if !m.AddVariable(name, value) {
walk.MsgBox(mw, "Error", "The variable has already existed.", walk.MsgBoxOK)
}
}
}
示例10: tv_ItemActivated
func (mw *PersonMainWindow) tv_ItemActivated() {
msg := ``
for _, i := range mw.tv.SelectedIndexes() {
msg = msg + "\n" + mw.model.items[i].Name
}
walk.MsgBox(mw, "title", msg, walk.MsgBoxIconInformation)
}
示例11: showError
func (mw *MainWindow) showError(err error) {
if err == nil {
return
}
walk.MsgBox(mw, "Error", err.Error(), walk.MsgBoxOK|walk.MsgBoxIconError)
}
示例12: msg
func (mw *MyWindow) msg(level string, message string) {
switch level {
case INFO:
log.SetPrefix(INFO)
title := "提示信息"
log.Printf("%s\n", message)
mw.notifyIcon.ShowInfo(title, message)
walk.MsgBox(mw, title, message, walk.MsgBoxIconInformation)
case DEBUG:
log.SetPrefix(DEBUG)
title := "警告信息"
log.Printf("%s\n", message)
mw.notifyIcon.ShowWarning(title, message)
walk.MsgBox(mw, title, message, walk.MsgBoxIconWarning)
}
}
示例13: NewElangGui
func NewElangGui() (this *ElangGui, err error) {
this = &ElangGui{Data: &ElangGuiData{"我学会了新的姿势", "厘侥氏阻仟议徊米", Mode1}}
var db *walk.DataBinder
update := func() {
src := this.mSrc.Text()
switch this.Data.Mode {
case Mode1:
src = zhconv.EncodeString(src)
src = elang.EncodeString(src)
src = zhconv.EncodeString(src)
case Mode2:
src = zhconv.DecodeString(src)
src = elang.DecodeString(src)
src = zhconv.EncodeString(src)
}
this.mTar.SetText(src)
}
wmodel := MainWindow{
AssignTo: &this.mw,
Title: "鹅语",
MinSize: Size{512, 450},
Layout: VBox{},
DataBinder: DataBinder{
AssignTo: &db,
DataSource: this.Data,
},
Children: []Widget{
TextEdit{
Text: Bind("Src"),
AssignTo: &this.mSrc,
},
RadioButtonGroupBox{
Title: "模式",
AssignTo: &this.mMode,
Layout: HBox{},
DataMember: "Mode",
Buttons: []RadioButton{
{Text: "模式一", Value: Mode1, OnClicked: update},
{Text: "模式二", Value: Mode2, OnClicked: update},
},
},
TextEdit{
Text: Bind("Dst"),
AssignTo: &this.mTar,
},
},
}
if err = wmodel.Create(); err != nil {
walk.MsgBox(nil, "错误", "创建窗口失败", walk.MsgBoxOK|walk.MsgBoxIconError)
return
}
if icon, err2 := walk.NewIconFromResource("ICON_MAIN"); err2 == nil {
this.mw.SetIcon(icon)
}
this.mSrc.TextChanged().Attach(update)
db.SetAutoSubmit(true)
return
}
示例14: myMsg
func (mw *MyDialog) myMsg(title, message string, style walk.MsgBoxStyle) {
switch style {
case walk.MsgBoxIconInformation:
mw.ni.ShowInfo(title, message)
case walk.MsgBoxIconWarning:
mw.ni.ShowWarning(title, message)
}
log.Println(message)
walk.MsgBox(mw, title, message, style)
}
示例15: main
func main() {
walk.Initialize(walk.InitParams{PanicOnError: true})
defer walk.Shutdown()
myWindow, _ := walk.NewMainWindow()
myWindow.SetLayout(walk.NewVBoxLayout())
myWindow.SetTitle("Listbox example")
splitter, _ := walk.NewSplitter(myWindow)
splitter.SetOrientation(walk.Vertical)
lb, _ := walk.NewListBox(splitter)
valueEdit, _ := walk.NewTextEdit(splitter)
valueEdit.SetReadOnly(true)
//env model
em := NewEnvModel()
for _, env := range os.Environ() {
i := strings.Index(env, "=")
if i == 0 {
continue
}
varName := env[0:i]
value := env[i+1:]
envItem := EnvItem{varName, value}
em.envItems = append(em.envItems, envItem)
}
fmt.Println("The len of Model", em.ItemCount())
lb.SetModel(em)
lb.CurrentIndexChanged().Attach(func() {
if curVar, ok := em.Value(lb.CurrentIndex()).(string); ok {
value := em.envItems[lb.CurrentIndex()].value
value = strings.Replace(value, ";", "\r\n", -1)
valueEdit.SetText(value)
fmt.Println("CurrentIndex:", lb.CurrentIndex())
fmt.Println("CurrentEnvVarName:", curVar)
}
})
lb.DblClicked().Attach(func() {
value := em.envItems[lb.CurrentIndex()].value
value = strings.Replace(value, ";", "\r\n", -1)
valueEdit.SetText(value)
walk.MsgBox(myWindow, "About", value, walk.MsgBoxOK|walk.MsgBoxIconInformation)
})
myWindow.Show()
myWindow.SetMinMaxSize(walk.Size{320, 240}, walk.Size{})
myWindow.SetSize(walk.Size{400, 500})
myWindow.Run()
}