summaryrefslogtreecommitdiff
path: root/andlabs/addText.go
blob: d335be2e6ef8eab1723aa64c625a59b4d6f02cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main

import (
	"go.wit.com/log"
	"go.wit.com/gui/widget"
	"go.wit.com/gui/toolkits/tree"
)

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.Warn("andlabs addText() Attempt on", n.WidgetType, "with", a.Value)

	switch n.WidgetType {
	case widget.Dropdown:
		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:
		addComboboxName(n, widget.GetString(a.Value))
	default:
		log.Log(ERROR, "plugin Send() Don't know how to addText on", n.WidgetType, "yet", a.ActionType)
	}
	log.Log(CHANGE, "addText() END with a.Value =", a.Value)
}