From e0775877c8d6a4e3a19fe9c85057b3387788adc2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 19 Feb 2025 06:54:54 -0600 Subject: [PATCH] starting the table window --- addNode.go | 5 ++++- table.go | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/addNode.go b/addNode.go index dea9153..981cc62 100644 --- a/addNode.go +++ b/addNode.go @@ -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 diff --git a/table.go b/table.go index e7ed3d1..1ccbddd 100644 --- a/table.go +++ b/table.go @@ -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) {