make common Delete() code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
aa3e8f14f5
commit
179dd22fe0
15
addNode.go
15
addNode.go
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
9
init.go
9
init.go
|
@ -31,18 +31,21 @@ func (me *TreeInfo) catchActionChannel() {
|
|||
log.Info("catchActionChannel() for loop")
|
||||
select {
|
||||
case a := <-me.pluginChan:
|
||||
log.Info("catchActionChannel() SELECT widget id =", a.WidgetId, a.ProgName)
|
||||
log.Warn("catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
log.Verbose("catchActionChannel() on ", a.WidgetId, a.WidgetType, a.ProgName)
|
||||
// log.Warn("catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
/*
|
||||
if a.WidgetType == widget.Dropdown {
|
||||
log.Warn("Found dropdown", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
for i, s := range a.State.Strings {
|
||||
log.Warn("a.State.Strings =", i, s)
|
||||
}
|
||||
}
|
||||
*/
|
||||
muAction.Lock()
|
||||
// send this to the toolkit
|
||||
me.toolkit(a)
|
||||
muAction.Unlock()
|
||||
log.Info("catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
// log.Info("catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue