fix all the GTK errorrs
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
369a8941a8
commit
3f2645e4b0
19
table.go
19
table.go
|
@ -3,6 +3,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
// import "os"
|
||||||
import "log"
|
import "log"
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
@ -36,6 +37,7 @@ type modelHandler struct {
|
||||||
yellowRow int
|
yellowRow int
|
||||||
checkStates []int
|
checkStates []int
|
||||||
vms []vmRowData
|
vms []vmRowData
|
||||||
|
columnTypes string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDefaultModelHandler() *modelHandler {
|
func newDefaultModelHandler() *modelHandler {
|
||||||
|
@ -54,6 +56,7 @@ func newDefaultModelHandler() *modelHandler {
|
||||||
func newJcarrModelHandler() *modelHandler {
|
func newJcarrModelHandler() *modelHandler {
|
||||||
mh := new(modelHandler)
|
mh := new(modelHandler)
|
||||||
mh.rows = 10
|
mh.rows = 10
|
||||||
|
mh.columnTypes = "standard"
|
||||||
mh.bgcolorColumn = 0
|
mh.bgcolorColumn = 0
|
||||||
mh.checkStates = make([]int, mh.rows)
|
mh.checkStates = make([]int, mh.rows)
|
||||||
mh.vms = make([]vmRowData, mh.rows)
|
mh.vms = make([]vmRowData, mh.rows)
|
||||||
|
@ -76,9 +79,16 @@ func standardColumnTypes() []ui.TableValue {
|
||||||
|
|
||||||
func (mh *modelHandler) ColumnTypes(m *ui.TableModel) []ui.TableValue {
|
func (mh *modelHandler) ColumnTypes(m *ui.TableModel) []ui.TableValue {
|
||||||
// log.Println("ColumnTypes() with m=", m, "mh=", mh)
|
// log.Println("ColumnTypes() with m=", m, "mh=", mh)
|
||||||
if (mh.name == "jcarrTable") {
|
if (mh.columnTypes == "standard") {
|
||||||
// log.Println("ColumnTypes() with m=", m, "mh=", mh)
|
|
||||||
return standardColumnTypes()
|
return standardColumnTypes()
|
||||||
|
/*
|
||||||
|
return []ui.TableValue{
|
||||||
|
ui.TableColor{}, // row background color
|
||||||
|
ui.TableString(""), // column 0 text
|
||||||
|
ui.TableColor{}, // column 0 text color
|
||||||
|
ui.TableString("test"), // column 1 button text
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
return []ui.TableValue{
|
return []ui.TableValue{
|
||||||
ui.TableString(""), // column 0 text
|
ui.TableString(""), // column 0 text
|
||||||
|
@ -98,7 +108,7 @@ var img [2]*ui.Image
|
||||||
func (mh *modelHandler) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
|
func (mh *modelHandler) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
|
||||||
// TODO: Figure out why this is being called 1000 times a second (10 times for each row & column)
|
// TODO: Figure out why this is being called 1000 times a second (10 times for each row & column)
|
||||||
// log.Println("CallValue() row=", row, "column=", column)
|
// log.Println("CallValue() row=", row, "column=", column)
|
||||||
if (mh.name == "jcarrTable") {
|
if (mh.columnTypes == "standard") {
|
||||||
switch column {
|
switch column {
|
||||||
case 0:
|
case 0:
|
||||||
if (row % 2) == 1 {
|
if (row % 2) == 1 {
|
||||||
|
@ -164,7 +174,7 @@ func (mh *modelHandler) SetCellValue(m *ui.TableModel, row, column int, value ui
|
||||||
log.Println("SetCallValue() START")
|
log.Println("SetCallValue() START")
|
||||||
spew.Dump(m)
|
spew.Dump(m)
|
||||||
spew.Dump(mh)
|
spew.Dump(mh)
|
||||||
if (mh.name == "jcarrTable") {
|
if (mh.columnTypes == "standard") {
|
||||||
if column == 3 { // button row (?)
|
if column == 3 { // button row (?)
|
||||||
log.Println("Button was pressed START", row, column)
|
log.Println("Button was pressed START", row, column)
|
||||||
}
|
}
|
||||||
|
@ -237,6 +247,7 @@ func makeJcarrtable(name string) (*ui.Table, *modelHandler, *ui.TableModel) {
|
||||||
func newModelHandler(rows int) *modelHandler {
|
func newModelHandler(rows int) *modelHandler {
|
||||||
mh := new(modelHandler)
|
mh := new(modelHandler)
|
||||||
mh.rows = rows
|
mh.rows = rows
|
||||||
|
mh.columnTypes = "standard"
|
||||||
mh.bgcolorColumn = 0
|
mh.bgcolorColumn = 0
|
||||||
mh.checkStates = make([]int, mh.rows)
|
mh.checkStates = make([]int, mh.rows)
|
||||||
mh.vms = make([]vmRowData, mh.rows)
|
mh.vms = make([]vmRowData, mh.rows)
|
||||||
|
|
Loading…
Reference in New Issue