From ec829f6e2be515b717d0ebd20b56623e44aff810 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 9 Feb 2024 10:26:42 -0600 Subject: binary tree is global Signed-off-by: Jeff Carr --- addNode.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addNode.go') diff --git a/addNode.go b/addNode.go index e0af110..cab2852 100644 --- a/addNode.go +++ b/addNode.go @@ -24,19 +24,19 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node { if a.WidgetType == widget.Root { log.Log(TREE, "AddNode() Root") n.Parent = n - me.treeRoot = n + treeRoot = n return n } - if me.treeRoot.FindWidgetId(a.WidgetId) != nil { + if treeRoot.FindWidgetId(a.WidgetId) != nil { log.Log(TREEWARN, "AddNode() WidgetId already exists", a.WidgetId) log.Log(TREEWARN, "probably this is a Show() / Hide() issue") log.Log(TREEWARN, "TODO: figure out what to do here") - return me.treeRoot.FindWidgetId(a.WidgetId) + return treeRoot.FindWidgetId(a.WidgetId) } // add this new widget on the binary tree - p := me.treeRoot.FindWidgetId(a.ParentId) + p := treeRoot.FindWidgetId(a.ParentId) n.Parent = p if n.Parent == nil { log.Log(TREEWARN, "AddNode() ERROR n.Parent == nil n =", n.WidgetId, n.WidgetType, n.GetProgName()) -- cgit v1.2.3