start removing the fixed entries from before
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
9b58fc0eb0
commit
63fd4607dc
56
table.go
56
table.go
|
@ -75,6 +75,7 @@ func initValues(mh *modelHandler) {
|
|||
mh.rows[i].cells[3].name = "BUTTON"
|
||||
|
||||
|
||||
/*
|
||||
// text for Column 2
|
||||
mh.rows[i].cells[4].value = ui.TableString(fmt.Sprintf("color %d", i))
|
||||
mh.rows[i].cells[4].name = "EDIT"
|
||||
|
@ -93,10 +94,11 @@ func initValues(mh *modelHandler) {
|
|||
// text color for Column 3
|
||||
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) {
|
||||
func initColorColumn(mh *modelHandler, stringID int, colorID int, junk string, color ui.TableColor) {
|
||||
mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableString(""))
|
||||
mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableColor{})
|
||||
|
||||
|
@ -104,33 +106,16 @@ func initColorColumn(mh *modelHandler, stringID int, colorID int) {
|
|||
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].value = ui.TableString(fmt.Sprintf("%s %d", junk, 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].value = color
|
||||
mh.rows[i].cells[colorID].name = "COLOR"
|
||||
}
|
||||
|
||||
// this causes a segfault?
|
||||
// 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)
|
||||
}
|
||||
|
||||
func newModelHandler(rowcount int) *modelHandler {
|
||||
|
@ -146,13 +131,24 @@ func newModelHandler(rowcount int) *modelHandler {
|
|||
|
||||
initValues(mh)
|
||||
|
||||
initColorColumn(mh, 6, 7)
|
||||
color := ui.TableColor{0.0, 0.9, 0.4, 1}
|
||||
initColorColumn(mh, 4, 5, "jwc45blah", color)
|
||||
|
||||
color = ui.TableColor{0.3, 0.1, 0.9, 1}
|
||||
initColorColumn(mh, 6, 7, "jwc67blah", color)
|
||||
|
||||
log.Println("Called newModelHandler() with mh=", mh)
|
||||
spew.Dump(mh)
|
||||
return mh
|
||||
}
|
||||
|
||||
func appendColorColumn(mh *modelHandler, table *ui.Table, stringID int, colorID int, columnName string) {
|
||||
table.AppendTextColumn(columnName, stringID, ui.TableModelColumnAlwaysEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: colorID,
|
||||
});
|
||||
}
|
||||
|
||||
func makeTable(name string, rowcount int, row1Name string) (*ui.Table, *modelHandler, *ui.TableModel) {
|
||||
mh := newModelHandler(rowcount)
|
||||
mh.name = name
|
||||
|
@ -167,20 +163,8 @@ func makeTable(name string, rowcount int, row1Name string) (*ui.Table, *modelHan
|
|||
table.AppendTextColumn(row1Name, 1, ui.TableModelColumnAlwaysEditable, nil)
|
||||
table.AppendButtonColumn("Details", 3, ui.TableModelColumnAlwaysEditable)
|
||||
|
||||
// text color doesn't work like this?
|
||||
table.AppendTextColumn("testcolor", 4, ui.TableModelColumnAlwaysEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: 5,
|
||||
});
|
||||
|
||||
appendColorColumn(mh, table, 6, 7)
|
||||
|
||||
/*
|
||||
table.AppendImageTextColumn("testimagecolor", 6, 7, ui.TableModelColumnNeverEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: 8,
|
||||
});
|
||||
*/
|
||||
appendColorColumn(mh, table, 4, 5, "testcolor")
|
||||
appendColorColumn(mh, table, 6, 7, "appendTest")
|
||||
|
||||
return table, mh, model
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue