2024-01-17 23:54:19 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/log"
|
|
|
|
"go.wit.com/toolkits/tree"
|
2024-01-18 04:27:19 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-17 23:54:19 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func compareStrings(n *tree.Node, ss []string) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func addText(n *tree.Node, a *widget.Action) {
|
|
|
|
var tk *guiWidget
|
|
|
|
tk = n.TK.(*guiWidget)
|
2024-01-21 11:30:12 -06:00
|
|
|
log.Log(ANDLABS, "addText() START with a.Value =", a.Value)
|
2024-01-17 23:54:19 -06:00
|
|
|
if tk == nil {
|
|
|
|
log.Log(ERROR, "addText error. tk == nil", n.State.ProgName, n.WidgetId)
|
|
|
|
return
|
|
|
|
}
|
2024-01-21 11:30:12 -06:00
|
|
|
log.Log(ANDLABS, "addText() Attempt on", n.WidgetType, "with", a.Value)
|
2024-01-17 23:54:19 -06:00
|
|
|
|
|
|
|
switch n.WidgetType {
|
|
|
|
case widget.Dropdown:
|
|
|
|
for i, s := range a.State.Strings {
|
2024-01-21 11:30:12 -06:00
|
|
|
log.Log(ANDLABS, "a.State.Strings =", i, s)
|
2024-01-17 23:54:19 -06:00
|
|
|
_, ok := n.Strings[s]
|
|
|
|
// If the key exists
|
|
|
|
if ok {
|
2024-01-21 11:30:12 -06:00
|
|
|
log.Log(ANDLABS, "string is already in the dropdown", i, s)
|
2024-01-17 23:54:19 -06:00
|
|
|
} else {
|
2024-01-21 11:30:12 -06:00
|
|
|
log.Log(ANDLABS, "adding new string to dropdown", i, s)
|
2024-01-17 23:54:19 -06:00
|
|
|
addDropdownName(n, s)
|
|
|
|
// TODO: make numbers
|
|
|
|
n.Strings[s] = 21
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case widget.Combobox:
|
|
|
|
addComboboxName(n, widget.GetString(a.Value))
|
|
|
|
default:
|
|
|
|
log.Log(ERROR, "plugin Send() Don't know how to addText on", n.WidgetType, "yet", a.ActionType)
|
|
|
|
}
|
2024-01-21 11:30:12 -06:00
|
|
|
log.Log(ANDLABS, "addText() END with a.Value =", a.Value)
|
2024-01-17 23:54:19 -06:00
|
|
|
}
|