trap window close and correctly exit
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f283a656dc
commit
6dadeae3fd
14
area.go
14
area.go
|
@ -7,10 +7,6 @@ import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
func areaClick(a int, b string) {
|
|
||||||
log.Println("GOT areaClick(a,b) =", a, b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeSplashArea(custom func(int, string)) *ui.Area {
|
func makeSplashArea(custom func(int, string)) *ui.Area {
|
||||||
// make this button just to get the default font (but don't display the button)
|
// make this button just to get the default font (but don't display the button)
|
||||||
// There should be another way to do this (?)
|
// There should be another way to do this (?)
|
||||||
|
@ -80,7 +76,9 @@ func (ah areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
|
||||||
|
|
||||||
func (ah areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
|
func (ah areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
|
||||||
log.Println("GOT MouseEvent()")
|
log.Println("GOT MouseEvent()")
|
||||||
spew.Dump(me)
|
if (Data.Debug) {
|
||||||
|
spew.Dump(me)
|
||||||
|
}
|
||||||
if (me.Down == 1) {
|
if (me.Down == 1) {
|
||||||
log.Println("GOT MOUSE DOWN")
|
log.Println("GOT MOUSE DOWN")
|
||||||
log.Println("GOT MOUSE DOWN")
|
log.Println("GOT MOUSE DOWN")
|
||||||
|
@ -90,10 +88,10 @@ func (ah areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
|
||||||
log.Println("GOT MOUSE UP")
|
log.Println("GOT MOUSE UP")
|
||||||
log.Println("GOT MOUSE UP")
|
log.Println("GOT MOUSE UP")
|
||||||
log.Println("GOT MOUSE UP")
|
log.Println("GOT MOUSE UP")
|
||||||
// splashWin.Destroy()
|
if (Data.ButtonClickNew != nil) {
|
||||||
// ui.Quit()
|
Data.ButtonClickNew(nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
areaClick(1, "done")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ah areaHandler) MouseCrossed(a *ui.Area, left bool) {
|
func (ah areaHandler) MouseCrossed(a *ui.Area, left bool) {
|
||||||
|
|
16
splash.go
16
splash.go
|
@ -30,13 +30,15 @@ func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(int, string)) *ui.B
|
||||||
version := "Version: " + Data.Version
|
version := "Version: " + Data.Version
|
||||||
newbox.Append(ui.NewLabel(version), false)
|
newbox.Append(ui.NewLabel(version), false)
|
||||||
|
|
||||||
if (Data.GitCommit != "") {
|
if (Data.Debug) {
|
||||||
tmp := "git rev-list: " + Data.GitCommit
|
if (Data.GitCommit != "") {
|
||||||
newbox.Append(ui.NewLabel(tmp), false)
|
tmp := "git rev-list: " + Data.GitCommit
|
||||||
}
|
newbox.Append(ui.NewLabel(tmp), false)
|
||||||
if (Data.GoVersion != "") {
|
}
|
||||||
tmp := "go build version: " + Data.GoVersion
|
if (Data.GoVersion != "") {
|
||||||
newbox.Append(ui.NewLabel(tmp), false)
|
tmp := "go build version: " + Data.GoVersion
|
||||||
|
newbox.Append(ui.NewLabel(tmp), false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
okButton := CreateButton("OK", "DONE", custom)
|
okButton := CreateButton("OK", "DONE", custom)
|
||||||
|
|
14
tabWindow.go
14
tabWindow.go
|
@ -61,11 +61,21 @@ func makeCloudWindow() {
|
||||||
Data.cloudWindow = ui.NewWindow("", 640, 480, true)
|
Data.cloudWindow = ui.NewWindow("", 640, 480, true)
|
||||||
// cloudWindow.SetBorderless(true)
|
// cloudWindow.SetBorderless(true)
|
||||||
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
||||||
ui.Quit()
|
if (Data.ButtonClickNew != nil) {
|
||||||
|
log.Println("Data.ButtonClickNew() START QUIT")
|
||||||
|
Data.State = "QUIT"
|
||||||
|
Data.ButtonClickNew(nil)
|
||||||
|
}
|
||||||
|
// ui.Quit()
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
Data.cloudWindow.Destroy()
|
if (Data.ButtonClickNew != nil) {
|
||||||
|
log.Println("Data.ButtonClickNew() START QUIT")
|
||||||
|
Data.State = "QUIT"
|
||||||
|
Data.ButtonClickNew(nil)
|
||||||
|
}
|
||||||
|
// Data.cloudWindow.Destroy()
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue