trap window close and correctly exit
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f283a656dc
commit
6dadeae3fd
12
area.go
12
area.go
|
@ -7,10 +7,6 @@ import _ "github.com/andlabs/ui/winmanifest"
|
|||
|
||||
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 {
|
||||
// make this button just to get the default font (but don't display the button)
|
||||
// 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) {
|
||||
log.Println("GOT MouseEvent()")
|
||||
if (Data.Debug) {
|
||||
spew.Dump(me)
|
||||
}
|
||||
if (me.Down == 1) {
|
||||
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")
|
||||
// splashWin.Destroy()
|
||||
// ui.Quit()
|
||||
if (Data.ButtonClickNew != nil) {
|
||||
Data.ButtonClickNew(nil)
|
||||
}
|
||||
}
|
||||
areaClick(1, "done")
|
||||
}
|
||||
|
||||
func (ah areaHandler) MouseCrossed(a *ui.Area, left bool) {
|
||||
|
|
|
@ -30,6 +30,7 @@ func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(int, string)) *ui.B
|
|||
version := "Version: " + Data.Version
|
||||
newbox.Append(ui.NewLabel(version), false)
|
||||
|
||||
if (Data.Debug) {
|
||||
if (Data.GitCommit != "") {
|
||||
tmp := "git rev-list: " + Data.GitCommit
|
||||
newbox.Append(ui.NewLabel(tmp), false)
|
||||
|
@ -38,6 +39,7 @@ func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(int, string)) *ui.B
|
|||
tmp := "go build version: " + Data.GoVersion
|
||||
newbox.Append(ui.NewLabel(tmp), false)
|
||||
}
|
||||
}
|
||||
|
||||
okButton := CreateButton("OK", "DONE", custom)
|
||||
newbox.Append(okButton, false)
|
||||
|
|
14
tabWindow.go
14
tabWindow.go
|
@ -61,11 +61,21 @@ func makeCloudWindow() {
|
|||
Data.cloudWindow = ui.NewWindow("", 640, 480, true)
|
||||
// cloudWindow.SetBorderless(true)
|
||||
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
|
||||
})
|
||||
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
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue