From 72c316dc990ca42faa23704ccf924ed0abd4e2c2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 22 May 2019 19:18:55 -0700 Subject: [PATCH] calls back on button clicks Signed-off-by: Jeff Carr --- gui.go | 1 + splash.go | 1 - tabWindow.go | 13 ++++--------- tableCallbacks.go | 6 ++---- vmWindow.go | 4 ++-- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/gui.go b/gui.go index 9a6f148..4d5810b 100644 --- a/gui.go +++ b/gui.go @@ -21,6 +21,7 @@ type GuiDataStructure struct { Width int Height int ButtonClick func(int, string) + CurrentVM string cloudWindow *ui.Window mainwin *ui.Window diff --git a/splash.go b/splash.go index a58cd72..5891da9 100644 --- a/splash.go +++ b/splash.go @@ -10,7 +10,6 @@ import "runtime" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -// var splashWin *ui.Window var MyArea *ui.Area func ShowSplash() *ui.Window { diff --git a/tabWindow.go b/tabWindow.go index 8f75848..876944b 100644 --- a/tabWindow.go +++ b/tabWindow.go @@ -30,16 +30,11 @@ func buttonClick(i int, s string) { log.Println("Figure out what to do here") log.Println("Figure out what to do here") log.Println("Figure out what to do here") - /* - cloudTab.Delete(0) - log.Println("Sleep(2000)") - time.Sleep(2000 * time.Millisecond) - - smallBox = AddAccountBox(nil, splashClose) - cloudTab.InsertAt("Intro", 0, smallBox) - cloudTab.SetMargined(0, true) - */ + if (Data.ButtonClick != nil) { + log.Println("Data.ButtonClick() START") + Data.ButtonClick(i, s) + } } func ShowAccountTab() { diff --git a/tableCallbacks.go b/tableCallbacks.go index b2c292d..a940fbe 100644 --- a/tableCallbacks.go +++ b/tableCallbacks.go @@ -15,8 +15,6 @@ import _ "github.com/andlabs/ui/winmanifest" import "github.com/gookit/config" -var CurrentVM string - func (mh *TableData) NumRows(m *ui.TableModel) int { if (config.String("debugging") == "true") { log.Println("NumRows = mh.RowCount = ", mh.RowCount) @@ -81,8 +79,8 @@ func defaultSetCellValue(mh *TableData, row int, column int) { vmname := mh.Rows[row].HumanData[humanID].Text log.Println("vmname =", vmname) log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column) - CurrentVM = fmt.Sprintf("%s",vmname) - log.Println("CurrentVM =", CurrentVM) + Data.CurrentVM = fmt.Sprintf("%s",vmname) + log.Println("Data.CurrentVM =", Data.CurrentVM) go ui.Main(ShowVM) } } diff --git a/vmWindow.go b/vmWindow.go index 2d62545..74e43bb 100644 --- a/vmWindow.go +++ b/vmWindow.go @@ -6,8 +6,8 @@ import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" func ShowVM() { - name := CurrentVM - log.Println("setupDemoUI() START CurrentVM=", CurrentVM) + name := Data.CurrentVM + log.Println("setupDemoUI() START Data.CurrentVM=", Data.CurrentVM) VMwin := ui.NewWindow("VM " + name, 500, 300, false) VMwin.OnClosing(func(*ui.Window) bool { return true