starting the table window

This commit is contained in:
Jeff Carr 2025-02-19 06:54:54 -06:00
parent f025713892
commit e0775877c8
2 changed files with 39 additions and 3 deletions

View File

@ -5,8 +5,11 @@ import (
"go.wit.com/widget"
)
// this is in common.go, do not move it
func (me *TreeInfo) AddNode(a *widget.Action) *Node {
return AddNode(a)
}
func AddNode(a *widget.Action) *Node {
n := new(Node)
n.WidgetType = a.WidgetType
n.WidgetId = a.WidgetId

View File

@ -33,12 +33,45 @@ func (me *TreeInfo) doTable(a widget.Action) {
for i, o := range t.Order {
log.Info("got order:", t.Title, i, o)
}
me.ShowTable(t)
dumpTable(t)
me.ShowTable(t)
me.makeTable(t)
}
}
func makeTable(t *guipb.Table) {
func makeTableWindow(pb *guipb.Widget) *Node {
a := new(widget.Action)
a.WidgetType = widget.Window
a.WidgetId = int(pb.Id)
a.ParentId = 0
a.State.Enable = true
return AddNode(a)
}
func (win *Node) makeWindowGrid(pb *guipb.Widget) *Node {
a := new(widget.Action)
a.WidgetType = widget.Grid
a.WidgetId = int(pb.Id)
a.ParentId = win.WidgetId
a.State.Enable = true
return AddNode(a)
}
func (me *TreeInfo) makeTable(t *guipb.Table) {
win := makeTableWindow(t.Window)
grid := win.makeWindowGrid(t.Grid)
me.Add(win)
me.Add(grid)
log.Info("tree: makeTable() finished add win & grid")
for i, r := range t.StringRows {
log.Info("got string row:", t.Title, i, r.Header, r.Vals)
for _, v := range r.Widgets {
log.Info("tree: add to grid here", v.Id, v.Name)
}
}
}
func dumpTable(t *guipb.Table) {