diff --git a/gui.go b/gui.go index d16e1ef..1ac1623 100644 --- a/gui.go +++ b/gui.go @@ -91,8 +91,13 @@ func initColumnNames(mh *TableData, cellJWC string, junk string) { func initRow(mh *TableData, row int, 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, row, tmpBTindex, parts[key]) tmpBTindex += 1 diff --git a/table.go b/table.go index 8ef7553..738c9fb 100644 --- a/table.go +++ b/table.go @@ -68,6 +68,8 @@ func initRowBTcolor(mh *TableData, row int, intBG int, cell InputData) { mh.Rows[row].Cells[intBG].Name = "BG" mh.Rows[row].Cells[intBG].HumanID = humanInt + log.Println("HumanID = row, intBG, humanInt", row, intBG, humanInt) + // alternate background of each row light and dark if (row % 2) == 1 { mh.Rows[row].Cells[intBG].Value = ui.TableColor{0.5, 0.5, 0.5, .7} @@ -87,6 +89,8 @@ func initRowButtonColumn(mh *TableData, row int, buttonID int, junk string, cell mh.Rows[row].Cells[buttonID].Value = ui.TableString(fmt.Sprintf("%s %d", junk, row)) mh.Rows[row].Cells[buttonID].Name = "BUTTON" mh.Rows[row].Cells[buttonID].HumanID = humanInt + + log.Println("HumanID = row, buttonID, humanInt", row, buttonID, humanInt) } func initRowTextColorColumn(mh *TableData, row int, stringID int, colorID int, junk string, color ui.TableColor, cell InputData) { diff --git a/tableCallbacks.go b/tableCallbacks.go index 9f8f707..7c05d0e 100644 --- a/tableCallbacks.go +++ b/tableCallbacks.go @@ -28,17 +28,29 @@ func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue } func (mh *TableData) SetCellValue(m *ui.TableModel, row, column int, value ui.TableValue) { - log.Println("SetCallValue() START row=", row, "column=", column, "value=", value) - // spew.Dump(m) - // spew.Dump(mh) + log.Println("SetCellValue() START row=", row, "column=", column, "value=", value) + if (mh.libUIevent == nil) { log.Println("CellValue NOT DEFINED. This table wasn't setup correctly! mh.scanCellValue == nil") os.Exit(-1) } - // spew.Dump(m) + mh.libUIevent(mh, m, row, column, value) if (mh.cellChangeEvent != nil) { mh.cellChangeEvent(row, column, value) } - log.Println("SetCallValue() END") + + log.Println("mh.Rows[0].Cells[column].HumanID =", mh.Rows[0].Cells[column].HumanID) + log.Println("mh.Rows[row].Cells[column].HumanID =", mh.Rows[row].Cells[column].HumanID) + + humanID := mh.Rows[row].Cells[column].HumanID + log.Println("mh.Rows[row].Human[humanID].ColorID =", mh.Rows[row].Human[humanID].ColorID) + log.Println("mh.Rows[row].Human[humanID].TextID =", mh.Rows[row].Human[humanID].TextID) + + if (column == mh.Rows[row].Human[humanID].TextID) { + log.Println("THIS COLUMN IS A TEXT COLUMN") + mh.Rows[row].Cells[column].Value = mh.Rows[row].Human[humanID].Text + } + + log.Println("SetCellValue() END") }