summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-11 19:32:40 -0600
committerJeff Carr <[email protected]>2024-01-11 19:32:40 -0600
commited951e0234d428298bd6b76b07e371ce2ab3cb60 (patch)
tree200c77deef52245e59dc96f591e16843a8125927 /common.go
parent5f6afb8cf8293f819711ccdf791296edfd7ce7d6 (diff)
var value anyv0.12.2
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'common.go')
-rw-r--r--common.go48
1 files changed, 29 insertions, 19 deletions
diff --git a/common.go b/common.go
index 795fd76..1d17d48 100644
--- a/common.go
+++ b/common.go
@@ -45,7 +45,7 @@ func (n *Node) Disable() *Node {
func (n *Node) Add(str string) {
log.Log(GUI, "gui.Add() value =", str)
- n.S = str
+ n.value = str
if ! n.hidden {
a := newAction(n, widget.Add)
@@ -56,8 +56,7 @@ func (n *Node) Add(str string) {
func (n *Node) AddText(str string) {
log.Log(CHANGE, "AddText() value =", str)
- n.Text = str
- n.S = str
+ n.value = str
if ! n.hidden {
a := newAction(n, widget.AddText)
@@ -72,9 +71,8 @@ func (n *Node) SetNext(w int, h int) {
}
func (n *Node) AppendText(str string) {
- tmp := n.S + str
- n.Text = tmp
- n.S = tmp
+ tmp := widget.GetString(n.value) + str
+ n.value = tmp
if ! n.hidden {
a := newAction(n, widget.SetText)
@@ -87,26 +85,31 @@ func (n *Node) AppendText(str string) {
// Value() ?
// Progname() Reference() ?
-// should get the value of the node
+// get a string from the widget
func (n *Node) GetText() string {
- if n.value != nil {
- return n.value.(string)
- }
- if (n.S != n.Text) {
- log.Warn("GetText() is screwed up. TODO: fix this dumb crap. n.S =", n.S, "and n.Text =", n.Text)
- }
- if (n.S != "") {
- return n.S
- }
- return n.Text
+ if ! n.Ready() { return "" }
+ return widget.GetString(n.value)
}
-// should get the value of the node
+// get a string from the widget
+func (n *Node) GetInt() int {
+ if ! n.Ready() { return -1 }
+ return widget.GetInt(n.value)
+}
+
+// get a string from the widget
+func (n *Node) GetBool() bool {
+ if ! n.Ready() { return false}
+ return widget.GetBool(n.value)
+}
+
+// should get the reference name used for programming and debugging
// myButton = myGroup.NewButton("hit ball", nil).SetName("HIT")
// myButton.GetName() should return "HIT"
// n = Find("HIT") should return myButton
func (n *Node) GetName() string {
- return n.Name
+ if ! n.Ready() { return "" }
+ return n.progname
}
/*
@@ -205,10 +208,17 @@ func (n *Node) Expand() *Node {
// me.window = myGui.New2().Window("DNS and IPv6 Control Panel").Standard()
// myFunnyWindow = myGui.NewWindow("Hello").Standard().SetText("Hola")
+/*
func (n *Node) Window(title string) *Node {
log.Warn("Window()", n)
return n.NewWindow(title)
}
+*/
+
+func (n *Node) ProgName() string {
+ if ! n.Ready() { return "" }
+ return n.progname
+}
func (n *Node) Ready() bool {
if n == nil {