summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-01 11:35:36 -0600
committerJeff Carr <[email protected]>2023-03-01 11:35:36 -0600
commit8dbf5a09097b7868e9218bf98716c57eac998a10 (patch)
treeab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /common.go
parentf3bb68396afa7452ecf1c8d4744c825a9d81057c (diff)
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing merge forceDump(bool) into Dump() debugging output configuration is pretty clean keep cutting down duplicate things --gui-verbose flag works make label "standard" code add debug.FreeOSMemory() move the GO language internals to display in the GUI update push to do tags and go to github.com/wit-go/ remove the other license file it might be confusing golang.org and github proper WidgetType added a Quit() button Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'common.go')
-rw-r--r--common.go44
1 files changed, 29 insertions, 15 deletions
diff --git a/common.go b/common.go
index 5dc098d..22e4319 100644
--- a/common.go
+++ b/common.go
@@ -1,17 +1,32 @@
package gui
-// import "errors"
-import "regexp"
+import (
+ "regexp"
+ // "errors"
+ // "git.wit.org/wit/gui/toolkit"
+)
// functions for handling text related GUI elements
func (n *Node) SetText(str string) bool {
- log(debugChange, "gui.SetText() value = FIXME. NOT DOING ANYTHING", str)
+ log(debugChange, "gui.SetText() value =", str)
+ n.widget.Action = "Set"
+ n.widget.S = str
+ send(n.parent, n)
+ return true
+}
+
+func (n *Node) AppendText(str string) bool {
+ n.widget.Action = "Set"
+ tmp := n.widget.S + str
+ log(debugChange, "gui.AppendText() value =", tmp)
+ n.widget.S = tmp
+ send(n.parent, n)
return true
}
func (n *Node) GetText() string {
- return "TODO: GetText() = {}"
+ return n.widget.S
}
/*
@@ -48,19 +63,18 @@ func normalizeInt(s string) string {
return clean
}
+func Delete(c *Node) {
+ c.widget.Action = "Delete"
+ send(c.parent, c)
+}
+
func commonCallback(n *Node) {
// TODO: make all of this common code to all the widgets
- if (n.OnChanged == nil) {
- log(debugChange, "Not Running n.OnChanged(n) == nil")
- } else {
- log(debugChange, "Running n.OnChanged(n)")
- n.OnChanged(n)
- }
-
- if (n.custom == nil) {
- log(debugChange, "Not Running n.custom(n) == nil")
+ // This might be common everywhere finally (2023/03/01)
+ if (n.Custom == nil) {
+ log(debugChange, "Not Running n.Custom(n) == nil")
} else {
- log(debugChange, "Running n.custom()")
- n.custom()
+ log(debugChange, "Running n.Custom(n)")
+ n.Custom()
}
}