summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'common.go')
-rw-r--r--common.go50
1 files changed, 32 insertions, 18 deletions
diff --git a/common.go b/common.go
index c6397fa..585e7dc 100644
--- a/common.go
+++ b/common.go
@@ -30,6 +30,7 @@ func (n *Node) Show() *Node {
}
func (n *Node) Hide() *Node {
+ return n
if ! n.Ready() { return n }
if n.Hidden() { return n }
@@ -79,6 +80,35 @@ func (n *Node) Disable() *Node {
return n
}
+func (n *Node) Bool() bool {
+ if ! n.Ready() { return false}
+
+ return widget.GetBool(n.value)
+}
+
+func (n *Node) Int() int {
+ if ! n.Ready() { return -1}
+
+ return widget.GetInt(n.value)
+}
+
+func (n *Node) String() string {
+ if ! n.Ready() { return ""}
+
+ return widget.GetString(n.value)
+}
+
+func (n *Node) Strings() []string {
+ if ! n.Ready() { return nil}
+ var tmp []string
+
+ for s, _ := range n.strings {
+ tmp = append(tmp, s)
+ }
+
+ return tmp
+}
+
func (n *Node) Destroy() {
if ! n.Ready() { return }
// if ! n.enabled { return }
@@ -91,24 +121,6 @@ func (n *Node) Destroy() {
return
}
-
-// add a new text string to widgets that support
-// multiple string values
-// These must be unique. return false if the string already exists
-func (n *Node) AddText(str string) bool {
- if ! n.Ready() { return false }
- log.Log(CHANGE, "AddText() value =", str)
-
- n.value = str
- // TODO: make sure these are unique
- n.strings = append(n.strings, str)
-
- // inform the toolkits
- sendAction(n, widget.AddText)
- return true
-}
-
-
// appends text to the existing text
// TODO: this is an experiement
func (n *Node) AppendText(str string) {
@@ -127,6 +139,7 @@ func (n *Node) AppendText(str string) {
// Progname() Reference() ?
// 2024/01/13 the names are starting to grow on me and make it clearer to code against
+/*
// get a string from the widget
func (n *Node) GetText() string {
if ! n.Ready() { return "" }
@@ -144,6 +157,7 @@ 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
func (n *Node) SetProgName(s string) *Node {