first successful column append
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f8e6200c4c
commit
9b58fc0eb0
41
table.go
41
table.go
|
@ -94,6 +94,42 @@ func initValues(mh *modelHandler) {
|
|||
mh.rows[i].cells[8].value = ui.TableColor{0.9, 0, 0, 1}
|
||||
mh.rows[i].cells[8].name = "COLOR"
|
||||
}
|
||||
}
|
||||
|
||||
func initColorColumn(mh *modelHandler, stringID int, colorID int) {
|
||||
mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableString(""))
|
||||
mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableColor{})
|
||||
|
||||
for i := 0; i < mh.rowcount; i++ {
|
||||
log.Println("i=",i)
|
||||
|
||||
// text for Column ?
|
||||
mh.rows[i].cells[stringID].value = ui.TableString(fmt.Sprintf("append %d", i))
|
||||
mh.rows[i].cells[stringID].name = "EDIT"
|
||||
|
||||
// text color for Column ?
|
||||
mh.rows[i].cells[colorID].value = ui.TableColor{0.0, 0.9, 0.4, 1}
|
||||
mh.rows[i].cells[colorID].name = "COLOR"
|
||||
}
|
||||
|
||||
// mh.rowcount = mh.rowcount + 2
|
||||
|
||||
}
|
||||
|
||||
func appendColorColumn(mh *modelHandler, table *ui.Table, stringID int, colorID int) {
|
||||
log.Println("mh.rows=", mh.rows)
|
||||
|
||||
textid := mh.rowcount + 1
|
||||
log.Println("textid=", textid)
|
||||
colorid := mh.rowcount + 2
|
||||
log.Println("colorid=", colorid)
|
||||
|
||||
// text color doesn't work like this?
|
||||
table.AppendTextColumn("testappend", stringID, ui.TableModelColumnAlwaysEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: colorID,
|
||||
});
|
||||
|
||||
// os.Exit(-1)
|
||||
}
|
||||
|
||||
|
@ -110,6 +146,8 @@ func newModelHandler(rowcount int) *modelHandler {
|
|||
|
||||
initValues(mh)
|
||||
|
||||
initColorColumn(mh, 6, 7)
|
||||
|
||||
log.Println("Called newModelHandler() with mh=", mh)
|
||||
spew.Dump(mh)
|
||||
return mh
|
||||
|
@ -130,11 +168,12 @@ func makeTable(name string, rowcount int, row1Name string) (*ui.Table, *modelHan
|
|||
table.AppendButtonColumn("Details", 3, ui.TableModelColumnAlwaysEditable)
|
||||
|
||||
// text color doesn't work like this?
|
||||
table.AppendTextColumn("testcolor", 4, ui.TableModelColumnAlwaysEditable,
|
||||
table.AppendTextColumn("testcolor", 4, ui.TableModelColumnAlwaysEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: 5,
|
||||
});
|
||||
|
||||
appendColorColumn(mh, table, 6, 7)
|
||||
|
||||
/*
|
||||
table.AppendImageTextColumn("testimagecolor", 6, 7, ui.TableModelColumnNeverEditable,
|
||||
|
|
Loading…
Reference in New Issue