start renaming variables to figure out what to do next
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f5be9dbd1e
commit
e41764285c
14
table.go
14
table.go
|
@ -22,7 +22,7 @@ type cellValue struct {
|
|||
|
||||
type modelHandler struct {
|
||||
name string
|
||||
rows int
|
||||
rowcount int
|
||||
rowBGcolor int
|
||||
|
||||
// new attempt
|
||||
|
@ -48,7 +48,7 @@ func initValues(mh *modelHandler) {
|
|||
mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableString(""))
|
||||
mh.generatedColumnTypes = append(mh.generatedColumnTypes, ui.TableColor{})
|
||||
|
||||
for i := 0; i < mh.rows; i++ {
|
||||
for i := 0; i < mh.rowcount; i++ {
|
||||
log.Println("i=",i)
|
||||
|
||||
// alternate background of each row light and dark
|
||||
|
@ -86,17 +86,17 @@ func initValues(mh *modelHandler) {
|
|||
// os.Exit(-1)
|
||||
}
|
||||
|
||||
func newModelHandler(rows int) *modelHandler {
|
||||
func newModelHandler(rowcount int) *modelHandler {
|
||||
mh := new(modelHandler)
|
||||
|
||||
mh.rows = rows
|
||||
mh.rowcount = rowcount
|
||||
|
||||
// These are the standard callback functions for libUI
|
||||
mh.setCellValue = defaultSetCellValue
|
||||
|
||||
mh.rowBGcolor = 0 // this is the weird exception. Just always have this as 0
|
||||
|
||||
mh.cellValues = make([]cellTest, mh.rows)
|
||||
mh.cellValues = make([]cellTest, mh.rowcount)
|
||||
|
||||
initValues(mh)
|
||||
|
||||
|
@ -105,8 +105,8 @@ func newModelHandler(rows int) *modelHandler {
|
|||
return mh
|
||||
}
|
||||
|
||||
func makeTable(name string, rows int, row1Name string) (*ui.Table, *modelHandler, *ui.TableModel) {
|
||||
mh := newModelHandler(rows)
|
||||
func makeTable(name string, rowcount int, row1Name string) (*ui.Table, *modelHandler, *ui.TableModel) {
|
||||
mh := newModelHandler(rowcount)
|
||||
mh.name = name
|
||||
model := ui.NewTableModel(mh)
|
||||
|
||||
|
|
|
@ -1,28 +1,24 @@
|
|||
package main
|
||||
|
||||
//
|
||||
// These functions are the hooks to the andlabs libui
|
||||
// They eventually feed information to the OS native GUI toolkits
|
||||
// and feed back user interaction with the GUI
|
||||
//
|
||||
|
||||
import "os"
|
||||
import "log"
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
// import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
func (mh *modelHandler) NumRows(m *ui.TableModel) int {
|
||||
// log.Println("NumRows() with m=", m)
|
||||
return mh.rows
|
||||
return mh.rowcount
|
||||
}
|
||||
|
||||
// FYI: this routine seems to be called around 10 to 100 times a second for each table
|
||||
func (mh *modelHandler) ColumnTypes(m *ui.TableModel) []ui.TableValue {
|
||||
return mh.generatedColumnTypes
|
||||
/*
|
||||
if (mh.funcColumnTypes == nil) {
|
||||
log.Println("ColumnTypes NOT DEFINED. This table wasn't setup correctly! mh.funcColmnTypes == nil")
|
||||
os.Exit(-1)
|
||||
}
|
||||
return mh.funcColumnTypes()
|
||||
*/
|
||||
}
|
||||
|
||||
// TODO: Figure out why this is being called 1000 times a second (10 times for each row & column)
|
||||
|
|
Loading…
Reference in New Issue