diff --git a/example-splash/area.go b/example-splash/area.go index 724688d..5255d3b 100644 --- a/example-splash/area.go +++ b/example-splash/area.go @@ -1,7 +1,7 @@ package main // import "time" -// import "log" +import "log" // import "fmt" // import "runtime" @@ -71,18 +71,20 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { } func (areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) { - // do nothing + log.Println("GOT MouseEvent()") + spew.Dump(me) } func (areaHandler) MouseCrossed(a *ui.Area, left bool) { - // do nothing + log.Println("GOT MouseCrossed()") } func (areaHandler) DragBroken(a *ui.Area) { - // do nothing + log.Println("GOT DragBroken()") } func (areaHandler) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) { - // reject all keys + log.Println("GOT KeyEvent()") + spew.Dump(ke) return false } diff --git a/example-splash/main.go b/example-splash/main.go index 95b5154..1724e33 100644 --- a/example-splash/main.go +++ b/example-splash/main.go @@ -3,6 +3,7 @@ package main import "time" import "log" import "fmt" +import "os" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" @@ -46,6 +47,7 @@ func setupUI() { mainwin := ui.NewWindow("gui-example1", 300, 200, false) mainwin.OnClosing(func(*ui.Window) bool { ui.Quit() + os.Exit(0) return true }) ui.OnShouldQuit(func() bool { @@ -66,7 +68,7 @@ func setupUI() { func main() { ui.Main(showSplash) - ui.Main(setupUI) + go ui.Main(setupUI) // locks up GTK after a while (50 times) time.Sleep(1000 * time.Millisecond)