From 9dc75044d72d559059d6627edda8937626725a94 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 15 Jun 2019 00:04:05 -0700 Subject: [PATCH] final cleanup on the generic mouse click code Signed-off-by: Jeff Carr --- gui-accounts.go | 2 +- gui-buttonClicks.go | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/gui-accounts.go b/gui-accounts.go index 2a24f5e..97a9e1a 100644 --- a/gui-accounts.go +++ b/gui-accounts.go @@ -58,7 +58,7 @@ func makeCloudInfoBox(gw *gui.GuiWindow) { log.Println("makeCloudInfoBox() Add Account") createAccount(box.Window) }) - makeButton(Xbox, nil, nil, "Quit", "QUIT", func (*gui.GuiButton) { + makeButton(Xbox, nil, nil, "Quit", "JUNK", func (*gui.GuiButton) { onExit(nil) }) makeButton(Xbox, nil, nil, "Debug", "DEBUG", debugClick) diff --git a/gui-buttonClicks.go b/gui-buttonClicks.go index 115dfe1..08c9b39 100644 --- a/gui-buttonClicks.go +++ b/gui-buttonClicks.go @@ -47,6 +47,9 @@ func mainMouseClick(b *gui.GuiButton) { if (b == nil) { log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?") log.Println("THIS IS PROBABLY A BUG IN git.wit.com/gui") + // gui.ErrorWindow(gw, + // "Unknown Mouse Event", + // "Error in mainMouseClick()") onExit(fmt.Errorf("mainMouseClick() got b = nil")) } log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE") @@ -55,32 +58,23 @@ func mainMouseClick(b *gui.GuiButton) { if (gw == nil) { log.Println("\tTHIS BUTTON IS BROKEN gw = nil") - panic("something") + gui.ErrorWindow(gw, + "Unknown Mouse Event", + "Error in mainMouseClick()") + // panic("something") + return } - var values *myButtonInfo - if tmp, ok := b.Values.(*myButtonInfo); ! ok { log.Println("\tmainMouseClick() values.Accounts error =", ok) log.Println("\tmainMouseClick() values.Accounts tmp =", tmp) } else { + var values *myButtonInfo values = tmp + log.Println("\tmainMouseClick() values.Accounts =", values.Accounts) + log.Println("\tmainMouseClick() values.Name = ", values.Name) + log.Println("\tmainMouseClick() values.Action =", values.Action) } - log.Println("\tmainMouseClick() values.Accounts =", values.Accounts) - log.Println("\tmainMouseClick() values.Name = ", values.Name) - - /* - if (values.Action == "QUIT") { - onExit(nil) - } else if (values.Action == "CREATE") { - log.Println("\tTRY TO ADD A NEW VIRTUAL MACHINE") - createVmClick(b) - } else if (values.Action == "SHOW") { - showAccountClick(b) - } - */ - log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE") - log.Println("mainMouseClick() FAILED TO FIND values.Action =", values.Action) log.Println("mainMouseClick() END") }