本文整理汇总了Golang中github.com/lxn/walk.NewAction函数的典型用法代码示例。如果您正苦于以下问题:Golang NewAction函数的具体用法?Golang NewAction怎么用?Golang NewAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewAction函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var tool *walk.Action
var menutool *walk.Menu
var mw *walk.MainWindow
mw.SetMaximizeBox(false)
mw.SetFixedSize(true)
mw, _ = walk.NewMainWindowCody()
mw.SetTitle("测试")
mw.SetSize(walk.Size{300, 200})
menutool, _ = walk.NewMenu()
tool = walk.NewMenuAction(menutool)
tool.SetText("文件")
open := walk.NewAction()
open.SetText("打开")
exit := walk.NewAction()
exit.SetText("退出")
menutool.Actions().Add(open)
menutool.Actions().Add(exit)
men2, _ := walk.NewMenu()
too2 := walk.NewMenuAction(men2)
too2.SetText("工具")
mw.Menu().Actions().Add(tool)
mw.Menu().Actions().Add(too2)
mw.Show()
mw.Run()
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:34,代码来源:main.go
示例2: main
func main() {
walk.Initialize(walk.InitParams{PanicOnError: true})
defer walk.Shutdown()
mainWnd, _ := walk.NewMainWindow()
mw := &MainWindow{MainWindow: mainWnd}
mw.SetLayout(walk.NewVBoxLayout())
mw.SetTitle("Walk Image Viewer Example")
mw.tabWidget, _ = walk.NewTabWidget(mw)
imageList, _ := walk.NewImageList(walk.Size{16, 16}, 0)
mw.ToolBar().SetImageList(imageList)
fileMenu, _ := walk.NewMenu()
fileMenuAction, _ := mw.Menu().Actions().AddMenu(fileMenu)
fileMenuAction.SetText("&File")
openBmp, _ := walk.NewBitmapFromFile("../img/open.png")
openAction := walk.NewAction()
openAction.SetImage(openBmp)
openAction.SetText("&Open")
openAction.Triggered().Attach(func() { mw.openImage() })
fileMenu.Actions().Add(openAction)
mw.ToolBar().Actions().Add(openAction)
exitAction := walk.NewAction()
exitAction.SetText("E&xit")
exitAction.Triggered().Attach(func() { walk.App().Exit(0) })
fileMenu.Actions().Add(exitAction)
helpMenu, _ := walk.NewMenu()
helpMenuAction, _ := mw.Menu().Actions().AddMenu(helpMenu)
helpMenuAction.SetText("&Help")
aboutAction := walk.NewAction()
aboutAction.SetText("&About")
aboutAction.Triggered().Attach(func() {
walk.MsgBox(mw, "About", "Walk Image Viewer Example", walk.MsgBoxOK|walk.MsgBoxIconInformation)
})
helpMenu.Actions().Add(aboutAction)
mw.SetMinMaxSize(walk.Size{320, 240}, walk.Size{})
mw.SetSize(walk.Size{800, 600})
mw.Show()
mw.Run()
}
开发者ID:hoperuin,项目名称:walk,代码行数:50,代码来源:imageviewer.go
示例3: switchEngine
func (mw *MyWindows) switchEngine() error {
menuEngine, _ := walk.NewMenu()
engine, _ := mw.ni.ContextMenu().Actions().AddMenu(menuEngine)
engine.SetText("切换视频源")
engineAction1 := walk.NewAction()
engineAction1.SetText("资源一")
engineAction2 := walk.NewAction()
engineAction2.SetText("资源二")
engineAction3 := walk.NewAction()
engineAction3.SetText("资源三")
engineAction1.SetChecked(true)
engineAction2.SetChecked(false)
engineAction3.SetChecked(false)
engineAction1.Triggered().Attach(func() {
requestUrl = engine1
engineAction1.SetChecked(true)
engineAction2.SetChecked(false)
engineAction3.SetChecked(false)
mw.OpenVip()
})
engineAction2.Triggered().Attach(func() {
requestUrl = engine2
engineAction1.SetChecked(false)
engineAction2.SetChecked(true)
engineAction3.SetChecked(false)
mw.OpenVip()
})
engineAction3.Triggered().Attach(func() {
requestUrl = engine3
engineAction1.SetChecked(false)
engineAction2.SetChecked(false)
engineAction3.SetChecked(true)
mw.OpenVip()
})
menuEngine.Actions().Add(engineAction1)
menuEngine.Actions().Add(engineAction2)
menuEngine.Actions().Add(engineAction3)
return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:49,代码来源:main.go
示例4: createAction
func (a Action) createAction(menu *walk.Menu) (*walk.Action, error) {
action := walk.NewAction()
if err := action.SetText(a.Text); err != nil {
return nil, err
}
if err := setActionImage(action, a.Image); err != nil {
return nil, err
}
if a.OnTriggered != nil {
action.Triggered().Attach(a.OnTriggered)
}
if menu != nil {
if err := menu.Actions().Add(action); err != nil {
return nil, err
}
}
if a.AssignTo != nil {
*a.AssignTo = action
}
return action, nil
}
开发者ID:karlma,项目名称:walk,代码行数:26,代码来源:action.go
示例5: AddMenuAction
func (this *Table) AddMenuAction(text string, cb func()) *Table {
act := walk.NewAction()
act.SetText(text)
act.Triggered().Attach(cb)
this.ContextMenu().Actions().Add(act)
return this
}
开发者ID:joy999,项目名称:walkwrap,代码行数:8,代码来源:Table.go
示例6: createAction
func (a Action) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
action := walk.NewAction()
if err := action.SetText(a.Text); err != nil {
return nil, err
}
if err := setActionImage(action, a.Image); err != nil {
return nil, err
}
if a.Enabled != nil {
if b, ok := a.Enabled.(bool); ok {
if err := action.SetEnabled(b); err != nil {
return nil, err
}
} else if s := builder.conditionOrProperty(a.Enabled); s != nil {
if c, ok := s.(walk.Condition); ok {
action.SetEnabledCondition(c)
} else {
return nil, fmt.Errorf("value of invalid type bound to Action.Enabled: %T", s)
}
}
}
if a.Visible != nil {
if b, ok := a.Visible.(bool); ok {
if err := action.SetVisible(b); err != nil {
return nil, err
}
} else if s := builder.conditionOrProperty(a.Visible); s != nil {
if c, ok := s.(walk.Condition); ok {
action.SetVisibleCondition(c)
} else {
return nil, fmt.Errorf("value of invalid type bound to Action.Visible: %T", s)
}
}
}
s := a.Shortcut
if err := action.SetShortcut(walk.Shortcut{s.Modifiers, s.Key}); err != nil {
return nil, err
}
if a.OnTriggered != nil {
action.Triggered().Attach(a.OnTriggered)
}
if menu != nil {
if err := menu.Actions().Add(action); err != nil {
return nil, err
}
}
if a.AssignTo != nil {
*a.AssignTo = action
}
return action, nil
}
开发者ID:jeffycf,项目名称:walk,代码行数:58,代码来源:action.go
示例7: addNotyfyAction
// 托盘图标
func (mw *MyWindow) addNotyfyAction() {
var err error
mw.notifyIcon, err = walk.NewNotifyIcon()
checkError(err)
mw.notifyIcon.SetVisible(true)
exitAction := walk.NewAction()
exitAction.SetText("退出程序")
exitAction.Triggered().Attach(func() {
mw.exit()
})
mw.notifyIcon.ContextMenu().Actions().Add(exitAction)
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:13,代码来源:main.go
示例8: RunApp
func (mw *MyWindow) RunApp() {
mw.model = NewLogModel()
open := walk.NewAction()
open.SetText("打开目录")
if err := (MainWindow{
AssignTo: &mw.MainWindow,
Title: "iMan高级调试日志解密工具 2.2",
Layout: VBox{},
MinSize: Size{980, 650},
Children: []Widget{
TableView{
AssignTo: &mw.tv,
LastColumnStretched: true,
ToolTipText: "把日志拖放上来即可解密.",
Columns: []TableViewColumn{
{Title: "序号", Width: 45},
{Title: "文件名", Width: 180},
{Title: "文件路径", Width: 200},
{Title: "状态", Width: 70},
{Title: "备注", Width: 0},
},
Model: mw.model,
OnCurrentIndexChanged: func() {
mw.row = mw.tv.CurrentIndex()
},
ContextMenuItems: []MenuItem{
ActionRef{&open},
},
},
},
}.CreateCody()); err != nil {
log.Fatal(err)
}
open.Triggered().Attach(func() {
if len(mw.model.items) == 0 {
runCMD("cmd /c start .").Run()
} else {
path, _ := os.Getwd()
runCMD("cmd /c start " + path + "\\logout\\").Run()
}
})
mw.dropFiles()
icon, _ := walk.NewIconFromResourceId(3)
mw.SetIcon(icon)
walk.MsgBox(mw, "提示", "把日志拖放到空白区即可解密!", walk.MsgBoxIconInformation)
mw.Run()
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:52,代码来源:main.go
示例9: openAction
func (mw *MyWindows) openAction() error {
openAction := walk.NewAction()
if err := openAction.SetText("打开VIP"); err != nil {
return err
}
openAction.Triggered().Attach(func() {
mw.OpenVip()
})
if err := mw.ni.ContextMenu().Actions().Add(openAction); err != nil {
return err
}
return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:14,代码来源:main.go
示例10: newNotify
func newNotify() {
var err error
context.notifyIcon, err = walk.NewNotifyIcon()
if err != nil {
common.Error("Error invoking NewNotifyIcon: %v", err)
}
icon, _ := walk.NewIconFromFile("res/lily.ico")
if err := context.notifyIcon.SetIcon(icon); err != nil {
common.Error("Error setting notify icon: %v", err)
}
if err := context.notifyIcon.SetToolTip("Click for info or use the context menu to exit."); err != nil {
common.Error("Fail to set tooltip: %v", err)
}
f := func() {
if !context.mw.Visible() {
context.mw.Show()
} else {
context.mw.SwitchToThisWindow()
}
}
go core.Triggered(f)
context.notifyIcon.MouseUp().Attach(func(x, y int, button walk.MouseButton) {
if button == walk.LeftButton {
f()
}
// if err := context.notifyIcon.ShowCustom(
// "Walk NotifyIcon Example",
// "There are multiple ShowX methods sporting different icons."); err != nil {
// common.Error("Fail to show custom notify: %v", err)
// }
})
exitAction := walk.NewAction()
if err := exitAction.SetText("退出"); err != nil {
common.Error("Error setting exitAction text: %v", err)
}
exitAction.Triggered().Attach(func() {
context.notifyIcon.Dispose()
// os.Exit(-1)
walk.App().Exit(0)
})
if err := context.notifyIcon.ContextMenu().Actions().Add(exitAction); err != nil {
common.Error("Error Adding exitAction: %v", err)
}
if err := context.notifyIcon.SetVisible(true); err != nil {
common.Error("Error setting notify visible: %v", err)
}
// if err := context.notifyIcon.ShowInfo("Walk NotifyIcon Example", "Click the icon to show again."); err != nil {
// common.Error("Error showing info: %v", err)
// }
}
开发者ID:tinycedar,项目名称:lily,代码行数:50,代码来源:notify.go
示例11: createAction
func (s Separator) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
action := walk.NewAction()
if err := action.SetText("-"); err != nil {
return nil, err
}
if menu != nil {
if err := menu.Actions().Add(action); err != nil {
return nil, err
}
}
return action, nil
}
开发者ID:bonyz,项目名称:walk,代码行数:15,代码来源:action.go
示例12: exitAction
func (mw *MyWindows) exitAction() error {
exitAction := walk.NewAction()
if err := exitAction.SetText("退出VIP"); err != nil {
return err
}
exitAction.Triggered().Attach(func() {
mw.ni.Dispose()
walk.App().Exit(0)
})
if err := mw.ni.ContextMenu().Actions().Add(exitAction); err != nil {
return err
}
return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:15,代码来源:main.go
示例13: createAction
func (a Action) createAction(menu *walk.Menu) (*walk.Action, error) {
action := walk.NewAction()
if _, err := a.initAction(action); err != nil {
return nil, err
}
if menu != nil {
if err := menu.Actions().Add(action); err != nil {
return nil, err
}
}
return action, nil
}
开发者ID:etel,项目名称:walk,代码行数:15,代码来源:action.go
示例14: main
func main() {
// Initialize walk and specify that we want errors to be panics.
walk.Initialize(walk.InitParams{PanicOnError: true})
defer walk.Shutdown()
// We need either a walk.MainWindow or a walk.Dialog for their message loop.
// We will not make it visible in this example, though.
mw, _ := walk.NewMainWindow()
// We load our icon from a file.
icon, _ := walk.NewIconFromFile("../img/x.ico")
// Create the notify icon and make sure we clean it up on exit.
ni, _ := walk.NewNotifyIcon()
defer ni.Dispose()
// Set the icon and a tool tip text.
ni.SetIcon(icon)
ni.SetToolTip("Click for info or use the context menu to exit.")
// When the left mouse button is pressed, bring up our balloon.
ni.MouseDown().Attach(func(x, y int, button walk.MouseButton) {
if button != walk.LeftButton {
return
}
ni.ShowCustom(
"Walk NotifyIcon Example",
"There are multiple ShowX methods sporting different icons.")
})
// We put an exit action into the context menu.
exitAction := walk.NewAction()
exitAction.SetText("E&xit")
exitAction.Triggered().Attach(func() { walk.App().Exit(0) })
ni.ContextMenu().Actions().Add(exitAction)
// The notify icon is hidden initially, so we have to make it visible.
ni.SetVisible(true)
// Now that the icon is visible, we can bring up an info balloon.
ni.ShowInfo("Walk NotifyIcon Example", "Click the icon to show again.")
// Run the message loop.
mw.Run()
}
开发者ID:etel,项目名称:walk,代码行数:46,代码来源:notifyicon.go
示例15: remoteAction
func (mw *MyWindows) remoteAction() error {
remoteAction := walk.NewAction()
if err := remoteAction.SetText("远程访问"); err != nil {
return err
}
remoteAction.Triggered().Attach(func() {
ip, err := getIP()
if err != nil {
log.Fatal(err)
}
mw.showMsg("远程访问", fmt.Sprintf("其他电脑在浏览器地址中输入 http://%s%s 进行访问。", ip, port))
})
if err := mw.ni.ContextMenu().Actions().Add(remoteAction); err != nil {
return err
}
return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:18,代码来源:main.go
示例16: AddMyNotifyAction
func (mw *MyDialog) AddMyNotifyAction() (err error) {
// We put an exit action into the context menu.
exitAction := walk.NewAction()
err = exitAction.SetText("退出程序")
mw.checkError(err)
exitAction.Triggered().Attach(func() {
mw.Dispose() // 释放主程序
mw.ni.Dispose() // 右下角图标退出
walk.App().Exit(1)
})
// 增加快捷键
exitAction.SetShortcut(walk.Shortcut{walk.ModShift, walk.KeyB})
// 提示信息
exitAction.SetToolTip("退出程序.")
err = mw.ni.ContextMenu().Actions().Add(exitAction)
mw.checkError(err)
return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:20,代码来源:upgrideiMan_ui.go
示例17: remoteClipboard
func (mw *MyWindows) remoteClipboard() error {
remoteAction := walk.NewAction()
if err := remoteAction.SetText("复制远程访问地址"); err != nil {
return err
}
remoteAction.Triggered().Attach(func() {
ip, err := getIP()
if err != nil {
log.Fatal(err)
}
// 先清空粘贴板
walk.Clipboard().Clear()
err = walk.Clipboard().SetText(fmt.Sprintf("http://%s%s", ip, port))
checkErr(err)
})
if err := mw.ni.ContextMenu().Actions().Add(remoteAction); err != nil {
return err
}
return nil
}
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:22,代码来源:main.go
示例18: init
func (mw *MyDialog) init(owner walk.Form) (err error) {
// 设置最小化
mw.SetMinimizeBox(true)
// 禁用最大化
mw.SetMaximizeBox(false)
// 设置窗口固定
mw.SetFixedSize(true)
// // 设置窗口前置
// mw.SetWindowPos(true)
mw.Dialog, err = walk.NewDialog(owner)
mw.checkError(err)
succeeded := false
defer func() {
if !succeeded {
mw.Dispose()
}
}()
// 设置主窗体大小
err = mw.SetClientSize(walk.Size{700, 560})
mw.checkError(err)
// 设置主窗体标题
err = mw.SetTitle("iMan-打包工具 V【" + _VERSION_ + "】")
mw.checkError(err)
// 设置
mw.ui.SettingMenu, _ = walk.NewMenu()
mw.ui.SettingAction = walk.NewMenuAction(mw.ui.SettingMenu)
mw.ui.SettingAction.SetText("设置")
mw.ui.ServerAction = walk.NewAction()
mw.ui.ServerAction.SetText("服务器")
mw.ui.SettingMenu.Actions().Add(mw.ui.ServerAction)
// 帮助
mw.ui.HelpMenu, _ = walk.NewMenu()
mw.ui.HelpAction = walk.NewMenuAction(mw.ui.HelpMenu)
mw.ui.HelpAction.SetText("帮助")
mw.ui.AboutAction = walk.NewAction()
mw.ui.AboutAction.SetText("关于")
mw.ui.HelpMenu.Actions().Add(mw.ui.AboutAction)
// 菜单配置
mw.Menu().Actions().Add(mw.ui.SettingAction)
mw.Menu().Actions().Add(mw.ui.HelpAction)
// 设置字体和图标
fountTitle, _ := walk.NewFont("幼圆", 10, walk.FontBold)
otherFont, _ := walk.NewFont("幼圆", 10, 0)
// 开始打包
mw.ui.StartPackingBtn, err = walk.NewPushButton(mw)
mw.checkError(err)
mw.ui.StartPackingBtn.SetText("开始打包")
mw.ui.StartPackingBtn.SetBounds(walk.Rectangle{310, 20, 75, 30})
// 版本配置
mw.ui.VersionGb, err = walk.NewGroupBox(mw)
mw.checkError(err)
mw.ui.VersionGb.SetTitle("版本配置")
mw.ui.VersionGb.SetFont(otherFont)
err = mw.ui.VersionGb.SetBounds(walk.Rectangle{10, 60, 330, 260})
mw.checkError(err)
// 版本类型
mw.ui.VersionTypeLb, err = walk.NewLabel(mw.ui.VersionGb)
mw.checkError(err)
mw.ui.VersionTypeLb.SetText("版本类型:")
mw.ui.VersionTypeLb.SetFont(fountTitle)
mw.ui.VersionTypeLb.SetBounds(walk.Rectangle{10, 20, 70, 25})
// 测试版
mw.ui.VersionTestRadio, err = walk.NewRadioButton(mw.ui.VersionGb)
mw.checkError(err)
mw.ui.VersionTestRadio.SetText("测试版")
mw.ui.VersionTestRadio.SetBounds(walk.Rectangle{110, 20, 60, 25})
mw.ui.VersionTestRadio.SetChecked(true)
// 正式版
mw.ui.VersionOffRadio, err = walk.NewRadioButton(mw.ui.VersionGb)
mw.checkError(err)
mw.ui.VersionOffRadio.SetText("正式版")
mw.ui.VersionOffRadio.SetBounds(walk.Rectangle{180, 20, 70, 25})
// 主版本号
mw.ui.MasterVersionLb, err = walk.NewLabel(mw.ui.VersionGb)
//.........这里部分代码省略.........
开发者ID:CodyGuo,项目名称:Go-Cody,代码行数:101,代码来源:upgrideiMan_ui.go
示例19: initPoseInfo
//.........这里部分代码省略.........
f, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, os.ModePerm)
if err != nil {
panic(err)
return
}
defer f.Close()
f.Truncate(0)
// buf := bufio.NewWriterSize(f, 1024 * 1000)
buf := bufio.NewWriter(f)
png.Encode(buf, result)
}
func setIcon(ui *walk.Action, fname string) {
fpath := "./img/" + fname
_, err := os.Stat(fpath)
if err != nil {
fmt.Println(err)
return
}
img, _ := walk.NewBitmapFromFile(fpath)
ui.SetImage(img)
}
func (mw *MainWindow) initMenu() {
fileMenu, _ := walk.NewMenu()
fileMenuAction, _ := mw.Menu().Actions().AddMenu(fileMenu)
fileMenuAction.SetText("&File")
imageList, _ := walk.NewImageList(walk.Size{TB_H, TB_H}, 0)
mw.ToolBar().SetImageList(imageList)
openAction := walk.NewAction()
setIcon(openAction, "open.png")
openAction.SetText("&Open")
openAction.Triggered().Attach(func() { go mw.openImage(MODE_COMPOSE) })
fileMenu.Actions().Add(openAction)
mw.ToolBar().Actions().Add(openAction)
///
// Load
loadAction := walk.NewAction()
setIcon(loadAction, "load.png")
loadAction.SetText("&Load")
loadAction.Triggered().Attach(func() { mw.openImage(MODE_PLAY) })
fileMenu.Actions().Add(loadAction)
mw.ToolBar().Actions().Add(loadAction)
helpMenu, _ := walk.NewMenu()
helpMenuAction, _ := mw.Menu().Actions().AddMenu(helpMenu)
helpMenuAction.SetText("&Help")
aboutAction := walk.NewAction()
helpMenu.Actions().Add(aboutAction)
aboutAction.SetText("&About")
aboutAction.Triggered().Attach(func() {
walk.MsgBox(mw, "About", "Image composer V0.1\nAuthor:heml",
walk.MsgBoxOK|walk.MsgBoxIconInformation)
})
// Image operations
// Save
mw.uiComposeAction = walk.NewAction()
setIcon(mw.uiComposeAction, "save.png")
mw.uiComposeAction.SetText("&Save")
开发者ID:hemaolong,项目名称:Rabbit,代码行数:67,代码来源:main.go
示例20: main
func main() {
walk.Initialize(walk.InitParams{PanicOnError: true})
defer walk.Shutdown()
mainWnd, _ := walk.NewMainWindow()
mw := &MainWindow{
MainWindow: mainWnd,
fileInfoModel: &FileInfoModel{},
}
mw.SetTitle("Walk File Browser Example")
mw.SetLayout(walk.NewHBoxLayout())
fileMenu, _ := walk.NewMenu()
fileMenuAction, _ := mw.Menu().Actions().AddMenu(fileMenu)
fileMenuAction.SetText("&File")
exitAction := walk.NewAction()
exitAction.SetText("E&xit")
exitAction.Triggered().Attach(func() { walk.App().Exit(0) })
fileMenu.Actions().Add(exitAction)
helpMenu, _ := walk.NewMenu()
helpMenuAction, _ := mw.Menu().Actions().AddMenu(helpMenu)
helpMenuAction.SetText("&Help")
aboutAction := walk.NewAction()
aboutAction.SetText("&About")
aboutAction.Triggered().Attach(func() {
walk.MsgBox(mw, "About", "Walk File Browser Example", walk.MsgBoxOK|walk.MsgBoxIconInformation)
})
helpMenu.Actions().Add(aboutAction)
splitter, _ := walk.NewSplitter(mw)
mw.treeView, _ = walk.NewTreeView(splitter)
mw.treeView.ItemExpanded().Attach(func(item *walk.TreeViewItem) {
children := item.Children()
if children.Len() == 1 && children.At(0).Text() == "" {
mw.populateTreeViewItem(item)
}
})
mw.treeView.SelectionChanged().Attach(func(old, new *walk.TreeViewItem) {
mw.selTvwItem = new
mw.showError(mw.fileInfoModel.ResetRows(pathForTreeViewItem(new)))
})
drives, _ := walk.DriveNames()
mw.treeView.SetSuspended(true)
for _, drive := range drives {
driveItem := newTreeViewItem(drive[:2])
mw.treeView.Items().Add(driveItem)
}
mw.treeView.SetSuspended(false)
mw.tableView, _ = walk.NewTableView(splitter)
mw.tableView.SetModel(mw.fileInfoModel)
mw.tableView.SetSingleItemSelection(true)
mw.tableView.CurrentIndexChanged().Attach(func() {
var url string
index := mw.tableView.CurrentIndex()
if index > -1 {
name := mw.fileInfoModel.items[index].Name
url = path.Join(pathForTreeViewItem(mw.selTvwItem), name)
}
mw.preview.SetURL(url)
})
mw.preview, _ = walk.NewWebView(splitter)
mw.SetMinMaxSize(walk.Size{600, 400}, walk.Size{})
mw.SetSize(walk.Size{800, 600})
mw.Show()
mw.Run()
}
开发者ID:hoperuin,项目名称:walk,代码行数:83,代码来源:filebrowser.go
注:本文中的github.com/lxn/walk.NewAction函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论