summaryrefslogtreecommitdiff
path: root/andlabs/setText.go
diff options
context:
space:
mode:
Diffstat (limited to 'andlabs/setText.go')
-rw-r--r--andlabs/setText.go39
1 files changed, 4 insertions, 35 deletions
diff --git a/andlabs/setText.go b/andlabs/setText.go
index 9aabd99..88b4df0 100644
--- a/andlabs/setText.go
+++ b/andlabs/setText.go
@@ -1,48 +1,17 @@
package main
import (
- "reflect"
- "strconv"
-
"go.wit.com/log"
"go.wit.com/gui/widget"
)
func (n *node) setText(a *widget.Action) {
- var name string
- var A any
- var k reflect.Kind
- A = a.A
- if a.A == nil {
- log.Warn("setText a.A == nil")
- A = ""
- }
-
- k = reflect.TypeOf(A).Kind()
-
- switch k {
- case reflect.Int:
- var i int
- i = A.(int)
- name = strconv.Itoa(i)
- case reflect.String:
- name = A.(string)
- case reflect.Bool:
- if A.(bool) == true {
- name = "true"
- } else {
- name = "false"
- }
- default:
- log.Warn("setText uknown kind", k, "value =", A)
- name = ""
- }
+ name := getString(a.Value)
log.Log(CHANGE, "setText() START with text =", name)
t := n.tk
if (t == nil) {
- log.Log(ERROR, "setText error. tk == nil", n.Name, n.WidgetId)
- actionDump(debugError, a)
+ log.Log(ERROR, "setText error. tk == nil", n.progname, n.WidgetId)
return
}
log.Log(CHANGE, "setText() Attempt on", n.WidgetType, "with", name)
@@ -68,9 +37,9 @@ func (n *node) setText(a *widget.Action) {
case widget.Button:
t.uiButton.SetText(name)
case widget.Slider:
- log.Log(ERROR, "setText() on slider unknown", a.ActionType, "on checkbox", n.Name)
+ log.Log(ERROR, "setText() on slider unknown", a.ActionType, "on checkbox", n.progname)
case widget.Spinner:
- log.Log(ERROR, "setText() on spinner unknown", a.ActionType, "on checkbox", n.Name)
+ log.Log(ERROR, "setText() on spinner unknown", a.ActionType, "on checkbox", n.progname)
case widget.Dropdown:
var orig int
var i int = -1