diff options
| author | Jeff Carr <[email protected]> | 2024-01-18 21:26:36 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-18 21:26:36 -0600 |
| commit | 179dd22fe03618d7b859dab17042c70e4098490d (patch) | |
| tree | c2ddea8ed11b407f46b725156936f193ef5b31bf /addNode.go | |
| parent | aa3e8f14f59a4432f20e032741a910dc0f490e3b (diff) | |
make common Delete() codev0.0.4
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'addNode.go')
| -rw-r--r-- | addNode.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -45,3 +45,18 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node { p.children = append(p.children, n) return n } + +func (n *Node) DeleteNode() { + p := n.Parent + for i, child := range p.children { + log.Warn("parent has child:", i, child.WidgetId, child.GetProgName()) + if n == child { + log.Warn("Found child ==", i, child.WidgetId, child.GetProgName()) + log.Warn("Found n ==", i, n.WidgetId, n.GetProgName()) + p.children = append(p.children[:i], p.children[i+1:]...) + } + } + for i, child := range p.children { + log.Warn("parent now has child:", i, child.WidgetId, child.GetProgName()) + } +} |
