Skip to content

Commit

Permalink
examples/webview: Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lxn committed Sep 23, 2012
1 parent 01a4680 commit 4c68332
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions examples/webview/webview.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,26 @@ import (
"github.com/lxn/walk"
)

type MainWindow struct {
*walk.MainWindow
urlLineEdit *walk.LineEdit
webView *walk.WebView
}

func main() {
walk.Initialize(walk.InitParams{PanicOnError: true})
defer walk.Shutdown()

mainWnd, _ := walk.NewMainWindow()

mw := &MainWindow{MainWindow: mainWnd}
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})

mw.urlLineEdit, _ = walk.NewLineEdit(mw)
mw.urlLineEdit.ReturnPressed().Attach(func() {
mw.webView.SetURL(mw.urlLineEdit.Text())
})
var webView *walk.WebView

mw.webView, _ = walk.NewWebView(mw)
urlLineEdit, _ := walk.NewLineEdit(mw)
urlLineEdit.ReturnPressed().Attach(func() {
webView.SetURL(urlLineEdit.Text())
})

mw.webView.SetURL("http://golang.org")
webView, _ = walk.NewWebView(mw)
webView.SetURL("http://golang.org")

mw.SetMinMaxSize(walk.Size{600, 400}, walk.Size{})
mw.SetSize(walk.Size{800, 600})
mw.Show()

mw.Run()
}

0 comments on commit 4c68332

Please sign in to comment.