calls back on button clicks

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-22 19:18:55 -07:00
parent 7ea694b086
commit 72c316dc99
5 changed files with 9 additions and 16 deletions

1
gui.go
View File

@ -21,6 +21,7 @@ type GuiDataStructure struct {
Width int Width int
Height int Height int
ButtonClick func(int, string) ButtonClick func(int, string)
CurrentVM string
cloudWindow *ui.Window cloudWindow *ui.Window
mainwin *ui.Window mainwin *ui.Window

View File

@ -10,7 +10,6 @@ import "runtime"
import "github.com/andlabs/ui" import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" import _ "github.com/andlabs/ui/winmanifest"
// var splashWin *ui.Window
var MyArea *ui.Area var MyArea *ui.Area
func ShowSplash() *ui.Window { func ShowSplash() *ui.Window {

View File

@ -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") 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)") if (Data.ButtonClick != nil) {
time.Sleep(2000 * time.Millisecond) log.Println("Data.ButtonClick() START")
Data.ButtonClick(i, s)
smallBox = AddAccountBox(nil, splashClose) }
cloudTab.InsertAt("Intro", 0, smallBox)
cloudTab.SetMargined(0, true)
*/
} }
func ShowAccountTab() { func ShowAccountTab() {

View File

@ -15,8 +15,6 @@ import _ "github.com/andlabs/ui/winmanifest"
import "github.com/gookit/config" import "github.com/gookit/config"
var CurrentVM string
func (mh *TableData) NumRows(m *ui.TableModel) int { func (mh *TableData) NumRows(m *ui.TableModel) int {
if (config.String("debugging") == "true") { if (config.String("debugging") == "true") {
log.Println("NumRows = mh.RowCount = ", mh.RowCount) 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 vmname := mh.Rows[row].HumanData[humanID].Text
log.Println("vmname =", vmname) log.Println("vmname =", vmname)
log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column) log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column)
CurrentVM = fmt.Sprintf("%s",vmname) Data.CurrentVM = fmt.Sprintf("%s",vmname)
log.Println("CurrentVM =", CurrentVM) log.Println("Data.CurrentVM =", Data.CurrentVM)
go ui.Main(ShowVM) go ui.Main(ShowVM)
} }
} }

View File

@ -6,8 +6,8 @@ import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" import _ "github.com/andlabs/ui/winmanifest"
func ShowVM() { func ShowVM() {
name := CurrentVM name := Data.CurrentVM
log.Println("setupDemoUI() START CurrentVM=", CurrentVM) log.Println("setupDemoUI() START Data.CurrentVM=", Data.CurrentVM)
VMwin := ui.NewWindow("VM " + name, 500, 300, false) VMwin := ui.NewWindow("VM " + name, 500, 300, false)
VMwin.OnClosing(func(*ui.Window) bool { VMwin.OnClosing(func(*ui.Window) bool {
return true return true