當前位置: 首頁>>代碼示例>>Golang>>正文


Golang walk.NewMenu函數代碼示例

本文整理匯總了Golang中github.com/lxn/walk.NewMenu函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewMenu函數的具體用法?Golang NewMenu怎麽用?Golang NewMenu使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewMenu函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createAction

func (m Menu) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
	subMenu, err := walk.NewMenu()
	if err != nil {
		return nil, err
	}

	action, err := menu.Actions().AddMenu(subMenu)
	if err != nil {
		return nil, err
	}

	if err := action.SetText(m.Text); err != nil {
		return nil, err
	}
	if err := setActionImage(action, m.Image); err != nil {
		return nil, err
	}

	for _, item := range m.Items {
		if _, err := item.createAction(builder, subMenu); err != nil {
			return nil, err
		}
	}

	if m.AssignActionTo != nil {
		*m.AssignActionTo = action
	}
	if m.AssignTo != nil {
		*m.AssignTo = subMenu
	}

	return action, nil
}
開發者ID:bonyz,項目名稱:walk,代碼行數:33,代碼來源:action.go

示例4: createAction

func (m Menu) createAction(menu *walk.Menu) (*walk.Action, error) {
	if menu == nil {
		var err error
		if menu, err = walk.NewMenu(); err != nil {
			return nil, err
		}
	}

	subMenu, err := walk.NewMenu()
	if err != nil {
		return nil, err
	}

	action, err := menu.Actions().AddMenu(subMenu)
	if err != nil {
		return nil, err
	}

	if err := action.SetText(m.Text); err != nil {
		return nil, err
	}
	if err := action.SetImage(m.Image); err != nil {
		return nil, err
	}

	for _, item := range m.Items {
		if _, err := item.createAction(subMenu); err != nil {
			return nil, err
		}
	}

	if m.AssignActionTo != nil {
		*m.AssignActionTo = action
	}
	if m.AssignTo != nil {
		*m.AssignTo = subMenu
	}

	return action, nil
}
開發者ID:etel,項目名稱:walk,代碼行數:40,代碼來源:action.go

示例5: 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

示例6: NewTable

func NewTable(parent walk.Container, width, height, x, y int) *Table {
	t := new(Table)
	t.model = NewTableModel()
	t.TableView, _ = walk.NewTableView(parent)
	t.SetWidth(width)
	t.SetHeight(height)
	t.SetX(x)
	t.SetY(y)
	t.SetModel(t.model)
	t.AddExStyle(win.LVS_EX_GRIDLINES)
	t.SetColumnsOrderable(false)

	menu, _ := walk.NewMenu()
	t.TableView.SetContextMenu(menu)

	return t
}
開發者ID:joy999,項目名稱:walkwrap,代碼行數:17,代碼來源:Table.go

示例7: createAction

func (m Menu) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
	subMenu, err := walk.NewMenu()
	if err != nil {
		return nil, err
	}

	var action *walk.Action
	if menu == nil {
		action = walk.NewMenuAction(subMenu)
	} else if action, err = menu.Actions().AddMenu(subMenu); err != nil {
		return nil, err
	}

	if err := action.SetText(m.Text); err != nil {
		return nil, err
	}
	if err := setActionImage(action, m.Image); err != nil {
		return nil, err
	}

	for _, item := range m.Items {
		if _, err := item.createAction(builder, subMenu); err != nil {
			return nil, err
		}
	}

	if m.OnTriggered != nil {
		action.Triggered().Attach(m.OnTriggered)
	}

	if m.AssignActionTo != nil {
		*m.AssignActionTo = action
	}
	if m.AssignTo != nil {
		*m.AssignTo = subMenu
	}

	return action, nil
}
開發者ID:Ryanker,項目名稱:walk,代碼行數:39,代碼來源:action.go

示例8: InitWidget

func (b *Builder) InitWidget(d Widget, w walk.Widget, customInit func() error) error {
	b.level++
	defer func() {
		b.level--
	}()

	var succeeded bool
	defer func() {
		if !succeeded {
			w.Dispose()
		}
	}()

	b.declWidgets = append(b.declWidgets, declWidget{d, w})

	// Widget
	name, _, _, font, toolTipText, minSize, maxSize, stretchFactor, row, rowSpan, column, columnSpan, contextMenuActions, onKeyDown, onMouseDown, onMouseMove, onMouseUp, onSizeChanged := d.WidgetInfo()

	w.SetName(name)

	if name != "" {
		b.name2Widget[name] = w
	}

	if toolTipText != "" {
		if err := w.SetToolTipText(toolTipText); err != nil {
			return err
		}
	}

	if err := w.SetMinMaxSize(minSize.toW(), maxSize.toW()); err != nil {
		return err
	}

	if len(contextMenuActions) > 0 {
		cm, err := walk.NewMenu()
		if err != nil {
			return err
		}
		if err := addToActionList(cm.Actions(), contextMenuActions); err != nil {
			return err
		}
		w.SetContextMenu(cm)
	}

	if onKeyDown != nil {
		w.KeyDown().Attach(onKeyDown)
	}

	if onMouseDown != nil {
		w.MouseDown().Attach(onMouseDown)
	}

	if onMouseMove != nil {
		w.MouseMove().Attach(onMouseMove)
	}

	if onMouseUp != nil {
		w.MouseUp().Attach(onMouseUp)
	}

	if onSizeChanged != nil {
		w.SizeChanged().Attach(onSizeChanged)
	}

	if p := w.Parent(); p != nil {
		switch l := p.Layout().(type) {
		case *walk.BoxLayout:
			if stretchFactor < 1 {
				stretchFactor = 1
			}
			if err := l.SetStretchFactor(w, stretchFactor); err != nil {
				return err
			}

		case *walk.GridLayout:
			cs := columnSpan
			if cs < 1 {
				cs = 1
			}
			rs := rowSpan
			if rs < 1 {
				rs = 1
			}
			r := walk.Rectangle{column, row, cs, rs}

			if err := l.SetRange(w, r); err != nil {
				return err
			}
		}
	}

	oldParent := b.parent

	// Container
	var db *walk.DataBinder
	if dc, ok := d.(Container); ok {
		if wc, ok := w.(walk.Container); ok {
			dataBinder, layout, children := dc.ContainerInfo()

//.........這裏部分代碼省略.........
開發者ID:Robin3D,項目名稱:walk,代碼行數:101,代碼來源:builder.go

示例9: InitWidget

func (b *Builder) InitWidget(d Widget, w walk.Window, customInit func() error) error {
	b.level++
	defer func() {
		b.level--
	}()

	var succeeded bool
	defer func() {
		if !succeeded {
			w.Dispose()
		}
	}()

	b.declWidgets = append(b.declWidgets, declWidget{d, w})

	// Widget
	name, _, _, font, toolTipText, minSize, maxSize, stretchFactor, row, rowSpan, column, columnSpan, alwaysConsumeSpace, contextMenuItems, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseUp, onSizeChanged := d.WidgetInfo()

	w.SetName(name)

	if name != "" {
		b.name2Window[name] = w
	}

	if toolTipText != "" {
		if widget, ok := w.(walk.Widget); ok {
			if err := widget.SetToolTipText(toolTipText); err != nil {
				return err
			}
		}
	}

	if err := w.SetMinMaxSize(minSize.toW(), maxSize.toW()); err != nil {
		return err
	}

	if len(contextMenuItems) > 0 {
		cm, err := walk.NewMenu()
		if err != nil {
			return err
		}

		b.deferBuildMenuActions(cm, contextMenuItems)

		w.SetContextMenu(cm)
	}

	if onKeyDown != nil {
		w.KeyDown().Attach(onKeyDown)
	}

	if onKeyPress != nil {
		w.KeyPress().Attach(onKeyPress)
	}

	if onKeyUp != nil {
		w.KeyUp().Attach(onKeyUp)
	}

	if onMouseDown != nil {
		w.MouseDown().Attach(onMouseDown)
	}

	if onMouseMove != nil {
		w.MouseMove().Attach(onMouseMove)
	}

	if onMouseUp != nil {
		w.MouseUp().Attach(onMouseUp)
	}

	if onSizeChanged != nil {
		w.SizeChanged().Attach(onSizeChanged)
	}

	if widget, ok := w.(walk.Widget); ok {
		if err := widget.SetAlwaysConsumeSpace(alwaysConsumeSpace); err != nil {
			return err
		}

		type SetStretchFactorer interface {
			SetStretchFactor(widget walk.Widget, factor int) error
		}

		if p := widget.Parent(); p != nil {
			if stretchFactor < 1 {
				stretchFactor = 1
			}

			switch l := p.Layout().(type) {
			case SetStretchFactorer:
				if err := l.SetStretchFactor(widget, stretchFactor); err != nil {
					return err
				}

			case *walk.GridLayout:
				csf := l.ColumnStretchFactor(column)
				if csf < stretchFactor {
					csf = stretchFactor
				}
//.........這裏部分代碼省略.........
開發者ID:linhua55,項目名稱:walk,代碼行數:101,代碼來源:builder.go

示例10: initPoseInfo


//.........這裏部分代碼省略.........
		col := i % frame
		row := i / frame
		drawBound := singleBound.Add(image.Point{sw * col, sh * row})
		draw.Draw(result, drawBound, _subImg, _subImg.Bounds().Min, draw.Src)
	}
	// Modify stride
	// fmt.Println("Stride ", result.Stride)

	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)
開發者ID:hemaolong,項目名稱:Rabbit,代碼行數:67,代碼來源:main.go

示例11: InitWidget

func InitWidget(d Widget, w walk.Widget, customInit func() error) error {
	var succeeded bool
	defer func() {
		if !succeeded {
			w.Dispose()
		}
	}()

	// Widget
	name, disabled, hidden, font, minSize, maxSize, stretchFactor, row, rowSpan, column, columnSpan, contextMenuActions := d.WidgetInfo()

	w.SetName(name)

	if err := w.SetMinMaxSize(minSize.toW(), maxSize.toW()); err != nil {
		return err
	}

	if len(contextMenuActions) > 0 {
		cm, err := walk.NewMenu()
		if err != nil {
			return err
		}
		if err := addToActionList(cm.Actions(), contextMenuActions); err != nil {
			return err
		}
		w.SetContextMenu(cm)
	}

	if p := w.Parent(); p != nil {
		switch l := p.Layout().(type) {
		case *walk.BoxLayout:
			if stretchFactor < 1 {
				stretchFactor = 1
			}
			if err := l.SetStretchFactor(w, stretchFactor); err != nil {
				return err
			}

		case *walk.GridLayout:
			cs := columnSpan
			if cs < 1 {
				cs = 1
			}
			rs := rowSpan
			if rs < 1 {
				rs = 1
			}
			r := walk.Rectangle{column, row, cs, rs}

			if err := l.SetRange(w, r); err != nil {
				return err
			}
		}
	}

	// Container
	if dc, ok := d.(Container); ok {
		if wc, ok := w.(walk.Container); ok {
			layout, children := dc.ContainerInfo()

			if layout != nil {
				l, err := layout.Create()
				if err != nil {
					return err
				}

				if err := wc.SetLayout(l); err != nil {
					return err
				}
			}

			for _, child := range children {
				if err := child.Create(wc); err != nil {
					return err
				}
			}
		}
	}

	// Widget continued
	w.SetEnabled(!disabled)
	w.SetVisible(!hidden)

	if font != nil {
		if f, err := font.Create(); err != nil {
			return err
		} else if f != nil {
			w.SetFont(f)
		}
	}

	// Custom
	if customInit != nil {
		if err := customInit(); err != nil {
			return err
		}
	}

	succeeded = true

//.........這裏部分代碼省略.........
開發者ID:etel,項目名稱:walk,代碼行數:101,代碼來源:util.go

示例12: 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

示例13: 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.NewMenu函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。