本文整理汇总了Golang中github.com/lxn/walk.WebView类的典型用法代码示例。如果您正苦于以下问题:Golang WebView类的具体用法?Golang WebView怎么用?Golang WebView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebView类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var le *walk.LineEdit
var wv *walk.WebView
MainWindow{
Title: "Walk WebView Example",
MinSize: Size{800, 600},
Layout: VBox{MarginsZero: true},
Children: []Widget{
LineEdit{
AssignTo: &le,
Text: Bind("wv.URL"),
OnKeyDown: func(key walk.Key) {
if key == walk.KeyReturn {
wv.SetURL(le.Text())
}
},
},
WebView{
AssignTo: &wv,
Name: "wv",
URL: "http://golang.org",
},
},
}.Run()
}
开发者ID:Fruchtgummi,项目名称:walk,代码行数:26,代码来源:webview.go
示例2: WebviewWindow
// Spawns a window containing a webview pointed at the given URL, and waits for
// it to be closed. If the webview cannot be opened, returns an error
// immediately.
func WebviewWindow(serverURL string) (e error) {
var mainWindow *walk.MainWindow
var webView *walk.WebView
log.Print("Starting to create webview window")
if err := (declarative.MainWindow{
AssignTo: &mainWindow,
Title: "WebCmd Webview",
MinSize: declarative.Size{600, 400},
Size: declarative.Size{800, 600},
Visible: true,
Layout: declarative.HBox{},
Children: []declarative.Widget{
declarative.WebView{
AssignTo: &webView,
},
},
}.Create()); err != nil {
log.Println("Error while creating window. Usually happens when " +
"compiled without -ldflags=\"-Hwindowsgui\" or a manifest. " +
"see make.bat to compile with window support on windows.")
return errors.New("Unable to create webview window")
}
log.Print("Create complete, initializing webView with URL ", serverURL)
webView.SetURL(serverURL)
mainWindow.Run()
log.Print("Webview closed.")
return nil
}
开发者ID:EricBurnett,项目名称:WebCmd,代码行数:33,代码来源:webview_windows.go
示例3: osOpenWindow
func osOpenWindow(window *Window, url string, styleFlags int) {
fmt.Println("osOpenWindow: ", window, url, styleFlags)
var dia *walk.Dialog
var le *walk.LineEdit
var wv *walk.WebView
windowStore[window.handle] = dia
Dialog{
AssignTo: &dia,
Title: "Window Title",
MinSize: Size{800, 600},
Layout: VBox{MarginsZero: true},
Children: []Widget{
LineEdit{
AssignTo: &le,
Text: Bind("wv.URL"),
OnKeyDown: func(key walk.Key) {
if key == walk.KeyReturn {
wv.SetURL(le.Text())
}
},
},
WebView{
AssignTo: &wv,
Name: "wv",
URL: url,
},
},
}.Run(mainWindow)
}
开发者ID:xinhuang327,项目名称:goui,代码行数:33,代码来源:goui_windows.go
示例4: main
func main() {
walk.Initialize(walk.InitParams{PanicOnError: true})
defer walk.Shutdown()
mw, _ := walk.NewMainWindow()
mw.SetTitle("Walk WebView Example")
mw.SetLayout(walk.NewVBoxLayout())
mw.SetMinMaxSize(walk.Size{600, 400}, walk.Size{})
mw.SetSize(walk.Size{800, 600})
var webView *walk.WebView
urlLineEdit, _ := walk.NewLineEdit(mw)
urlLineEdit.ReturnPressed().Attach(func() {
webView.SetURL(urlLineEdit.Text())
})
webView, _ = walk.NewWebView(mw)
webView.SetURL("http://golang.org")
mw.Show()
mw.Run()
}
开发者ID:etel,项目名称:walk,代码行数:23,代码来源:webview.go
示例5: main
func main() {
var le *walk.LineEdit
var wv *walk.WebView
MainWindow{
Title: "Walk WebView Example",
MinSize: Size{800, 600},
Layout: VBox{},
Children: []Widget{
LineEdit{
AssignTo: &le,
Text: Bind("wv.URL"),
OnReturnPressed: func() {
wv.SetURL(le.Text())
},
},
WebView{
AssignTo: &wv,
Name: "wv",
URL: "http://golang.org",
},
},
}.Run()
}
开发者ID:Robin3D,项目名称:walk,代码行数:24,代码来源:webview.go
示例6: main
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{},
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{
Title: "Name",
DataMember: "Name",
Width: 200,
},
TableViewColumn{
Title: "Size",
DataMember: "Size",
Format: "%d",
Alignment: AlignFar,
Width: 80,
},
TableViewColumn{
Title: "Modified",
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()
}
开发者ID:richardjoo,项目名称:walk,代码行数:81,代码来源:filebrowser.go
注:本文中的github.com/lxn/walk.WebView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论