start working on a VM window

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-15 11:03:42 -07:00
parent 20a71cca67
commit 6a9ff162d9
3 changed files with 44 additions and 1 deletions

View File

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

View File

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

29
vmWindow.go Normal file
View File

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