start working on a VM window
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
20a71cca67
commit
6a9ff162d9
7
demo.go
7
demo.go
|
@ -12,11 +12,16 @@ func SetupDemoUI() {
|
||||||
log.Println("setupDemoUI() START")
|
log.Println("setupDemoUI() START")
|
||||||
demowin = ui.NewWindow("Demo GUI Widgets", 500, 300, false)
|
demowin = ui.NewWindow("Demo GUI Widgets", 500, 300, false)
|
||||||
demowin.OnClosing(func(*ui.Window) bool {
|
demowin.OnClosing(func(*ui.Window) bool {
|
||||||
// ui.Quit()
|
// if demowin != nil {
|
||||||
|
// demowin.Destroy()
|
||||||
|
// }
|
||||||
|
// // ui.Quit()
|
||||||
|
// demowin = nil
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
demowin.Destroy()
|
demowin.Destroy()
|
||||||
|
demowin = nil
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@ package gui
|
||||||
//
|
//
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
var CurrentVM string
|
||||||
|
|
||||||
func (mh *TableData) NumRows(m *ui.TableModel) int {
|
func (mh *TableData) NumRows(m *ui.TableModel) int {
|
||||||
return mh.RowCount
|
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) {
|
func defaultSetCellValue(mh *TableData, row int, column int) {
|
||||||
if (mh.Cells[column].Name == "BUTTON") {
|
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)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
Loading…
Reference in New Issue