no longer need the setCell function callback
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
ab3cb83385
commit
f8000c2e23
9
gui.go
9
gui.go
|
@ -92,7 +92,7 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
|
|||
mh.Rows = make([]RowData, mh.RowCount)
|
||||
|
||||
// This is the standard callback function from libUI when the user does something
|
||||
mh.libUIevent = defaultSetCellValue
|
||||
// mh.libUIevent = defaultSetCellValue
|
||||
|
||||
tmpBTindex := 0
|
||||
|
||||
|
@ -122,11 +122,14 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
|
|||
table.AppendButtonColumn(foo.Heading, tmpBTindex, ui.TableModelColumnAlwaysEditable)
|
||||
} else if (foo.CellType == "TEXTCOLOR") {
|
||||
tmpBTindex += 1
|
||||
appendTextColorColumn (mh, table, tmpBTindex, tmpBTindex + 1, foo.Heading)
|
||||
table.AppendTextColumn(foo.Heading, tmpBTindex, ui.TableModelColumnAlwaysEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: tmpBTindex + 1,
|
||||
});
|
||||
tmpBTindex += 1
|
||||
} else if (foo.CellType == "TEXT") {
|
||||
tmpBTindex += 1
|
||||
appendTextColumn (mh, table, tmpBTindex, foo.Heading)
|
||||
table.AppendTextColumn(foo.Heading, tmpBTindex, ui.TableModelColumnAlwaysEditable, nil)
|
||||
} else {
|
||||
panic("I don't know what this is in initColumnNames")
|
||||
}
|
||||
|
|
15
table.go
15
table.go
|
@ -41,7 +41,7 @@ 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)
|
||||
// libUIevent func(*TableData, *ui.TableModel, int, int, ui.TableValue)
|
||||
cellChangeEvent func(int, int, ui.TableValue)
|
||||
}
|
||||
|
||||
|
@ -101,17 +101,7 @@ func initRowTextColumn(mh *TableData, row int, stringID int, junk string, cell I
|
|||
mh.Rows[row].Cells[stringID].HumanID = humanInt
|
||||
}
|
||||
|
||||
func appendTextColorColumn(mh *TableData, table *ui.Table, stringID int, colorID int, columnName string) {
|
||||
table.AppendTextColumn(columnName, stringID, ui.TableModelColumnAlwaysEditable,
|
||||
&ui.TableTextColumnOptionalParams{
|
||||
ColorModelColumn: colorID,
|
||||
});
|
||||
}
|
||||
|
||||
func appendTextColumn(mh *TableData, table *ui.Table, stringID int, columnName string) {
|
||||
table.AppendTextColumn(columnName, stringID, ui.TableModelColumnAlwaysEditable, nil)
|
||||
}
|
||||
|
||||
/*
|
||||
func defaultSetCellValue(mh *TableData, m *ui.TableModel, row, column int, value ui.TableValue) {
|
||||
if (mh.Rows[row].Cells[column].Name == "BUTTON") {
|
||||
log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column)
|
||||
|
@ -125,3 +115,4 @@ func simpleSetCellValue(mh *TableData, row, column int, value string) {
|
|||
}
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,6 @@ package gui
|
|||
// and feed back user interaction with the GUI
|
||||
//
|
||||
|
||||
import "os"
|
||||
import "log"
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
|
@ -38,12 +37,8 @@ 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("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)
|
||||
}
|
||||
defaultSetCellValue(mh, row, column)
|
||||
|
||||
mh.libUIevent(mh, m, row, column, value)
|
||||
if (mh.cellChangeEvent != nil) {
|
||||
mh.cellChangeEvent(row, column, value)
|
||||
}
|
||||
|
@ -57,3 +52,9 @@ func (mh *TableData) SetCellValue(m *ui.TableModel, row, column int, value ui.Ta
|
|||
|
||||
log.Println("SetCellValue() END")
|
||||
}
|
||||
|
||||
func defaultSetCellValue(mh *TableData, row int, column int) {
|
||||
if (mh.Rows[row].Cells[column].Name == "BUTTON") {
|
||||
log.Println("defaultSetCellValue() FOUND THE BUTTON!!!!!!! Button was pressed START", row, column)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue