summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'common.go')
-rw-r--r--common.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/common.go b/common.go
index 22e4319..1518bc8 100644
--- a/common.go
+++ b/common.go
@@ -8,6 +8,13 @@ import (
// functions for handling text related GUI elements
+func (n *Node) Add(str string) {
+ log(debugGui, "gui.Add() value =", str)
+ n.widget.Action = "Add"
+ n.widget.S = str
+ send(n.parent, n)
+}
+
func (n *Node) SetText(str string) bool {
log(debugChange, "gui.SetText() value =", str)
n.widget.Action = "Set"
@@ -16,6 +23,23 @@ func (n *Node) SetText(str string) bool {
return true
}
+func (n *Node) Set(a any) bool {
+ log(debugChange, "gui.Set() value =", a)
+ n.widget.Action = "Set"
+ switch v := a.(type) {
+ case bool:
+ n.widget.B = a.(bool)
+ case string:
+ n.widget.S = a.(string)
+ case int:
+ n.widget.I = a.(int)
+ default:
+ log(debugError, "gui.Set() unknown type =", v, "a =", a)
+ }
+ send(n.parent, n)
+ return true
+}
+
func (n *Node) AppendText(str string) bool {
n.widget.Action = "Set"
tmp := n.widget.S + str