From 2620425629c581462f5bbec64decf23152d05b15 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 21 Feb 2025 15:37:04 -0600 Subject: [PATCH] add SetParent() --- generateGui.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/generateGui.go b/generateGui.go index 8ddba01..23c4bcd 100644 --- a/generateGui.go +++ b/generateGui.go @@ -128,10 +128,18 @@ func guiMain(w io.Writer, FRUITS string, FRUIT string) { fmt.Fprintln(w, " return sf") fmt.Fprintln(w, "}") fmt.Fprintln(w, "") + fmt.Fprintln(w, "func (mt *"+FRUITS+"Table) SetParent(p *gui.Node) {") + fmt.Fprintln(w, " mt.parent = p") + fmt.Fprintln(w, "}") + fmt.Fprintln(w, "") fmt.Fprintln(w, "func (mt *"+FRUITS+"Table) ShowTable() {") fmt.Fprintln(w, " // log.Info(\"ShowTable() SENDING TO GUI\")") fmt.Fprintln(w, " mt.MakeTable()") - fmt.Fprintln(w, " gui.ShowTable(mt.pb)") + fmt.Fprintln(w, " if mt.parent == nil {") + fmt.Fprintln(w, " gui.ShowTable(mt.pb)") + fmt.Fprintln(w, " return") + fmt.Fprintln(w, " }") + fmt.Fprintln(w, " mt.parent.ShowTable(mt.pb)") fmt.Fprintln(w, "}") fmt.Fprintln(w, "") fmt.Fprintln(w, "type "+FRUIT+"StringFunc struct {") @@ -155,6 +163,7 @@ func guiMain(w io.Writer, FRUITS string, FRUIT string) { fmt.Fprintln(w, "type "+FRUITS+"Table struct {") fmt.Fprintln(w, " // gt *gui.NodeTable") fmt.Fprintln(w, " pb *guipb.Table") + fmt.Fprintln(w, " parent *gui.Node") fmt.Fprintln(w, " x *"+FRUITS+"") fmt.Fprintln(w, " hostnames []string") fmt.Fprintln(w, " stringFuncs []*"+FRUIT+"StringFunc")