From 841e6252c95244f0ee7faf2c01d33f69a8ab483a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 17 Jan 2024 21:31:49 -0600 Subject: common tree package for toolkits This update provides *lots* of toolkit updates. This will allow the next step of debugging the gocui toolkit to make it work again. There are new common routines for handling the plugin channel communication Signed-off-by: Jeff Carr --- andlabs/addText.go | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'andlabs/addText.go') diff --git a/andlabs/addText.go b/andlabs/addText.go index cbc9269..d335be2 100644 --- a/andlabs/addText.go +++ b/andlabs/addText.go @@ -3,22 +3,40 @@ package main import ( "go.wit.com/log" "go.wit.com/gui/widget" + "go.wit.com/gui/toolkits/tree" ) -func (n *node) addText(a *widget.Action) { - log.Log(CHANGE, "addText() START with a.Value =", a.Value) - t := n.tk - if (t == nil) { - log.Log(ERROR, "addText error. tk == nil", n.progname, n.WidgetId) +func compareStrings(n *tree.Node, ss []string) { +} + +// func (n *node) addText(a *widget.Action) { +func addText(n *tree.Node, a *widget.Action) { + var tk *guiWidget + tk = n.TK.(*guiWidget) + log.Warn("andlabs addText() START with a.Value =", a.Value) + if (tk == nil) { + log.Log(ERROR, "addText error. tk == nil", n.State.ProgName, n.WidgetId) return } - log.Log(CHANGE, "addText() Attempt on", n.WidgetType, "with", a.Value) + log.Warn("andlabs addText() Attempt on", n.WidgetType, "with", a.Value) switch n.WidgetType { case widget.Dropdown: - n.addDropdownName(widget.GetString(a.Value)) + for i, s := range a.State.Strings { + log.Warn("andlabs a.State.Strings =", i, s) + _, ok := n.Strings[s] + // If the key exists + if ok { + log.Warn("andlabs a.State.Strings is here", i, s) + } else { + log.Warn("andlabs is not here", i, s) + addDropdownName(n, s) + // TODO: make numbers + n.Strings[s] = 21 + } + } case widget.Combobox: - n.addComboboxName(widget.GetString(a.Value)) + addComboboxName(n, widget.GetString(a.Value)) default: log.Log(ERROR, "plugin Send() Don't know how to addText on", n.WidgetType, "yet", a.ActionType) } -- cgit v1.2.3