better test4

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-29 20:48:51 -07:00
parent 9cd895db6e
commit 88b7c27bb9
1 changed files with 54 additions and 11 deletions

View File

@ -1,28 +1,71 @@
package main package main
// import "os" import "os"
// import "log" import "log"
import "github.com/davecgh/go-spew/spew"
import "git.wit.com/wit/gui" import "git.wit.com/wit/gui"
import pb "git.wit.com/wit/witProtobuf" import pb "git.wit.com/wit/witProtobuf"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
func main() { func main() {
c := pb.MakeDefaultConfig() c := pb.MakeDefaultConfig()
gui.Data.MouseClick = mainMouseClick
for { for {
gui.InitNewWindow(c, "SPLASH") gui.InitNewWindow(c, "SPLASH")
// aWinMap := gui.InitGUI(c)
// aWinMap.Action = "SPLASH"
// log.Println("main() aWinMap =", aWinMap)
gui.ShowWindow() gui.ShowWindow()
gui.InitNewWindow(c, "BLAH") gui.InitNewWindow(c, "BLAH")
// log.Println("main() bWinMap =", bWinMap)
// bWinMap.Action = "BLAH"
gui.ShowWindow() gui.ShowWindow()
} }
}
// gui.Data.Window2 = aWinMap
// gui.GoMainWindow() // This is the handler for all mosue clicks (buttons, areas, etc))
//
// This is massive for a reason. EVERY MOUSE CLICK COMES HERE
// the 'gui' code is kinda just a holder. It will pass everything
// here and we have to sort out what to do with the click
// at least, that is the current design because I thought it
// might be a good approach. Time will tell...
//
func mainMouseClick(b *gui.ButtonMap) {
if (b == nil) {
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
os.Exit(-1)
}
log.Println("mainMouseClick() b.Action =", b.Action)
log.Println("mainMouseClick() b.Action =", b.Account)
spew.Dump(b.Account)
var wm *gui.WindowMap
wm = b.WM
if (wm == nil) {
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm is nil) WHY DID THIS HAPPEN?")
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm is nil) WHY DID THIS HAPPEN?")
os.Exit(-1)
}
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE wm =", wm)
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE window wm.W =", wm.W)
if (wm.W == nil) {
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm.W is nil) WHY DID THIS HAPPEN?")
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm.W is nil) WHY DID THIS HAPPEN?")
os.Exit(-1)
}
if (b.Action == "NEWTEXT") {
log.Println("mainMouseClick() NEWTEXT wm.W =", wm.W)
} else if (b.Action == "SPLASH") {
log.Println("mainMouseClick() SPLASH wm.W =", wm.W)
} else if (b.Action == "AREA") {
log.Println("mainMouseClick() AREA wm.W =", wm.W)
wm.W.Destroy()
ui.Quit()
}
} }