diff options
| -rw-r--r-- | demo.go | 7 | ||||
| -rw-r--r-- | tableCallbacks.go | 9 | ||||
| -rw-r--r-- | vmWindow.go | 29 |
3 files changed, 44 insertions, 1 deletions
@@ -12,11 +12,16 @@ func SetupDemoUI() { log.Println("setupDemoUI() START") demowin = ui.NewWindow("Demo GUI Widgets", 500, 300, false) demowin.OnClosing(func(*ui.Window) bool { - // ui.Quit() +// if demowin != nil { +// demowin.Destroy() +// } +// // ui.Quit() +// demowin = nil return true }) ui.OnShouldQuit(func() bool { demowin.Destroy() + demowin = nil return true }) diff --git a/tableCallbacks.go b/tableCallbacks.go index b1655da..94d174a 100644 --- a/tableCallbacks.go +++ b/tableCallbacks.go @@ -7,10 +7,13 @@ package gui // import "log" +import "fmt" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" +var CurrentVM string + func (mh *TableData) NumRows(m *ui.TableModel) int { return mh.RowCount } @@ -58,6 +61,12 @@ func (mh *TableData) SetCellValue(m *ui.TableModel, row, column int, value ui.Ta func defaultSetCellValue(mh *TableData, row int, column int) { if (mh.Cells[column].Name == "BUTTON") { + humanID := mh.Cells[column].HumanID + 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) + go ui.Main(ShowVM) } } diff --git a/vmWindow.go b/vmWindow.go new file mode 100644 index 0000000..2d62545 --- /dev/null +++ b/vmWindow.go @@ -0,0 +1,29 @@ +package gui + +import "log" + +import "github.com/andlabs/ui" +import _ "github.com/andlabs/ui/winmanifest" + +func ShowVM() { + name := CurrentVM + log.Println("setupDemoUI() START CurrentVM=", CurrentVM) + VMwin := ui.NewWindow("VM " + name, 500, 300, false) + VMwin.OnClosing(func(*ui.Window) bool { + return true + }) + ui.OnShouldQuit(func() bool { + VMwin.Destroy() + VMwin = nil + return true + }) + + VMtab := ui.NewTab() + VMwin.SetChild(VMtab) + VMwin.SetMargined(true) + +// VMtab.Append("List examples", makeNumbersPage()) +// VMtab.SetMargined(0, true) + + VMwin.Show() +} |
