func (mw *MyMainWindow) showAboutBoxAction_Triggered() { walk.MsgBox(mw, "About", "Walk Actions Example", walk.MsgBoxIconInformation) }
func (mw *MyMainWindow) specialAction_Triggered() { walk.MsgBox(mw, "Special", "Nothing to see here.", walk.MsgBoxIconInformation) }
func (mw *MyMainWindow) changeViewAction_Triggered() { walk.MsgBox(mw, "Change View", "By now you may have guessed it. Nothing changed.", walk.MsgBoxIconInformation) }
func (mw *MyMainWindow) newAction_Triggered() { walk.MsgBox(mw, "New", "Newing something up... or not.", walk.MsgBoxIconInformation) }
func (mw *MyMainWindow) openAction_Triggered() { walk.MsgBox(mw, "Open", "Pretend to open a file...", walk.MsgBoxIconInformation) }
func (mw *MyMainWindow) lb_ItemActivated() { value := mw.model.items[mw.lb.CurrentIndex()].value walk.MsgBox(mw, "Value", value, walk.MsgBoxIconInformation) }
func main() { var mainWindow *walk.MainWindow var treeView *walk.TreeView var tableView *walk.TableView var webView *walk.WebView treeModel, err := NewDirectoryTreeModel() if err != nil { log.Fatal(err) } tableModel := NewFileInfoModel() if err := (MainWindow{ AssignTo: &mainWindow, Title: "Walk File Browser Example", MinSize: Size{600, 400}, Size: Size{800, 600}, Layout: HBox{MarginsZero: true}, Children: []Widget{ HSplitter{ Children: []Widget{ TreeView{ AssignTo: &treeView, Model: treeModel, OnCurrentItemChanged: func() { dir := treeView.CurrentItem().(*Directory) if err := tableModel.SetDirPath(dir.Path()); err != nil { walk.MsgBox( mainWindow, "Error", err.Error(), walk.MsgBoxOK|walk.MsgBoxIconError) } }, }, TableView{ AssignTo: &tableView, Columns: []TableViewColumn{ TableViewColumn{ DataMember: "Name", Width: 200, }, TableViewColumn{ DataMember: "Size", Format: "%d", Alignment: AlignFar, Width: 80, }, TableViewColumn{ DataMember: "Modified", Format: "2006-01-02 15:04:05", Width: 120, }, }, Model: tableModel, OnCurrentIndexChanged: func() { var url string if index := tableView.CurrentIndex(); index > -1 { name := tableModel.items[index].Name dir := treeView.CurrentItem().(*Directory) url = filepath.Join(dir.Path(), name) } webView.SetURL(url) }, }, WebView{ AssignTo: &webView, }, }, }, }, }.Create()); err != nil { log.Fatal(err) } mainWindow.Run() }