correctly delete window gocui views

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-01 10:37:33 -06:00
parent e4339f33ac
commit 11ebc77505
1 changed files with 13 additions and 0 deletions

View File

@ -105,6 +105,18 @@ func action(a widget.Action) {
log.Log(INFO, "action() END")
}
func (w *guiWidget) deleteGocuiViews() {
if w.v == nil {
// no gocui view to delete for this widget
} else {
me.baseGui.DeleteView(w.cuiName)
w.v = nil
}
for _, child := range w.children {
child.deleteGocuiViews()
}
}
func (w *guiWidget) deleteNode() {
p := w.parent
for i, child := range p.children {
@ -118,6 +130,7 @@ func (w *guiWidget) deleteNode() {
for i, child := range p.children {
log.Log(NOW, "parent now has child:", i, child.cuiName, child.String())
}
w.deleteGocuiViews()
}
func (w *guiWidget) AddText(text string) {