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
Height int
ButtonClick func(int, string)
CurrentVM string
cloudWindow *ui.Window
mainwin *ui.Window

View File

@ -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 {

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")
/*
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() {

View File

@ -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)
}
}

View File

@ -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