keep trying to move column numbers to common structs

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-06 17:33:29 -07:00
parent 3a40ecad4c
commit 673b5b245c
3 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package main
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
var mainwin *ui.Window

View File

@ -31,6 +31,7 @@ type uiColumn struct {
type modelHandler struct {
name string
rows int
bgcolorColumn int
yellowRow int
checkStates []int
vms []vmRowData
@ -52,6 +53,7 @@ func newDefaultModelHandler() *modelHandler {
func newJcarrModelHandler() *modelHandler {
mh := new(modelHandler)
mh.rows = 10
mh.bgcolorColumn = 0
mh.checkStates = make([]int, mh.rows)
mh.vms = make([]vmRowData, mh.rows)
mh.vms[8].hostname = "jcarr"
@ -86,11 +88,6 @@ func (mh *modelHandler) ColumnTypes(m *ui.TableModel) []ui.TableValue {
}
}
func (mh *modelHandler) NumRows(m *ui.TableModel) int {
// log.Println("NumRows() with m=", m)
return mh.rows
}
var img [2]*ui.Image
func (mh *modelHandler) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
@ -223,7 +220,7 @@ func makeJcarrtable(name string) (*ui.Table, *modelHandler, *ui.TableModel) {
table := ui.NewTable(
&ui.TableParams{
Model: model,
RowBackgroundColorModelColumn: 0,
RowBackgroundColorModelColumn: mh.bgcolorColumn,
})
table.AppendTextColumn("hostname", 1, ui.TableModelColumnNeverEditable, nil)

8
tableCallbacks.go Normal file
View File

@ -0,0 +1,8 @@
package main
import "github.com/andlabs/ui"
func (mh *modelHandler) NumRows(m *ui.TableModel) int {
// log.Println("NumRows() with m=", m)
return mh.rows
}