combined table column init
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f3eeb4e9ec
commit
5ec1416d20
46
gui.go
46
gui.go
|
@ -58,33 +58,6 @@ func initColumnNames(mh *TableData, cellJWC string, junk string) {
|
|||
}
|
||||
}
|
||||
|
||||
func initRow(mh *TableData, parts []InputData) {
|
||||
tmpBTindex := 0
|
||||
humanID := 0
|
||||
for key, foo := range parts {
|
||||
log.Println(key, foo)
|
||||
|
||||
parts[key].Index = humanID
|
||||
humanID += 1
|
||||
|
||||
if (foo.CellType == "BG") {
|
||||
initRowBTcolor (mh, tmpBTindex, parts[key])
|
||||
tmpBTindex += 1
|
||||
} else if (foo.CellType == "BUTTON") {
|
||||
initRowButtonColumn (mh, tmpBTindex, parts[key].Heading, parts[key])
|
||||
tmpBTindex += 1
|
||||
} else if (foo.CellType == "TEXTCOLOR") {
|
||||
initRowTextColorColumn(mh, tmpBTindex, tmpBTindex + 1, parts[key].Heading, ui.TableColor{0.0, 0, 0.9, 1}, parts[key])
|
||||
tmpBTindex += 2
|
||||
} else if (foo.CellType == "TEXT") {
|
||||
initRowTextColumn (mh, tmpBTindex, parts[key].Heading, parts[key])
|
||||
tmpBTindex += 1
|
||||
} else {
|
||||
panic("I don't know what this is in initColumnNames")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts []InputData) *TableData {
|
||||
mh := new(TableData)
|
||||
|
||||
|
@ -92,18 +65,13 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
|
|||
mh.Rows = make([]RowData, mh.RowCount)
|
||||
|
||||
tmpBTindex := 0
|
||||
|
||||
humanID := 0
|
||||
for key, foo := range parts {
|
||||
log.Println(key, foo)
|
||||
log.Println("key, foo =", key, foo)
|
||||
// log.Println("mh.Cells =", mh.Cells)
|
||||
// log.Println("mh.Human =", mh.Human)
|
||||
|
||||
initColumnNames(mh, foo.CellType, foo.Heading)
|
||||
}
|
||||
|
||||
/*
|
||||
tmpBTindex = 0
|
||||
humanID = 0
|
||||
|
||||
for key, foo := range parts {
|
||||
log.Println(key, foo)
|
||||
|
||||
parts[key].Index = humanID
|
||||
humanID += 1
|
||||
|
@ -124,8 +92,8 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
|
|||
panic("I don't know what this is in initColumnNames")
|
||||
}
|
||||
}
|
||||
*/
|
||||
initRow(mh, parts)
|
||||
tmpBTindex = 0
|
||||
humanID = 0
|
||||
|
||||
model := ui.NewTableModel(mh)
|
||||
table := ui.NewTable(
|
||||
|
|
6
table.go
6
table.go
|
@ -46,11 +46,9 @@ type TableData struct {
|
|||
RowWidth int // This is how wide each row is
|
||||
Rows []RowData // This is all the table data by row
|
||||
generatedColumnTypes []ui.TableValue // generate this dynamically
|
||||
// libUIevent func(*TableData, *ui.TableModel, int, int, ui.TableValue)
|
||||
cellChangeEvent func(int, int, ui.TableValue)
|
||||
|
||||
Cells [20]CellData
|
||||
Human [20]HumanMap
|
||||
Cells [20]CellData
|
||||
Human [20]HumanMap
|
||||
}
|
||||
|
||||
func initRowBTcolor(mh *TableData, intBG int, cell InputData) {
|
||||
|
|
|
@ -30,7 +30,14 @@ func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue
|
|||
if (column == mh.Human[humanID].ColorID) {
|
||||
return mh.Rows[row].HumanData[humanID].Color
|
||||
}
|
||||
panic("not sure what sort of ui.TableValue to return in CellValue()")
|
||||
log.Println("CellValue() FAILURE")
|
||||
log.Println("CellValue() FAILURE")
|
||||
log.Println("CellValue() row, column = ", row, column)
|
||||
log.Println("CellValue() FAILURE")
|
||||
log.Println("CellValue() FAILURE")
|
||||
log.Println("CellValue() mh.Cells", mh.Cells)
|
||||
log.Println("CellValue() mh.Human", mh.Human)
|
||||
panic("CellValue() not sure what sort of ui.TableValue to return in CellValue()")
|
||||
return ui.TableString("")
|
||||
}
|
||||
|
||||
|
@ -39,10 +46,6 @@ func (mh *TableData) SetCellValue(m *ui.TableModel, row, column int, value ui.Ta
|
|||
|
||||
defaultSetCellValue(mh, row, column)
|
||||
|
||||
if (mh.cellChangeEvent != nil) {
|
||||
mh.cellChangeEvent(row, column, value)
|
||||
}
|
||||
|
||||
log.Println("mh.Cells[column].HumanID =", mh.Cells[column].HumanID)
|
||||
// log.Println("mh.Rows[row].Cells[column].HumanID =", mh.Rows[row].Cells[column].HumanID)
|
||||
|
||||
|
|
Loading…
Reference in New Issue