summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'common.go')
-rw-r--r--common.go73
1 files changed, 12 insertions, 61 deletions
diff --git a/common.go b/common.go
index 755872a..56ad5d5 100644
--- a/common.go
+++ b/common.go
@@ -5,7 +5,6 @@ package gui
import (
"go.wit.com/log"
"go.wit.com/widget"
- "regexp"
)
// functions for handling text related GUI elements
@@ -34,13 +33,14 @@ func (n *Node) Show() *Node {
}
func (n *Node) Hide() *Node {
- return n
if !n.Ready() {
return n
}
- if n.Hidden() {
- return n
- }
+ /*
+ if n.Hidden() {
+ return n
+ }
+ */
if n.WidgetType == widget.Window {
log.Warn("Hide on a window", n.progname)
@@ -137,6 +137,7 @@ func (n *Node) Destroy() {
n.enabled = false
n.changed = true
+ log.Warn("SENDING DESTROY ON", n.WidgetType, n.id, n.GetProgName())
// inform the toolkits
sendAction(n, widget.Delete)
return
@@ -156,33 +157,13 @@ func (n *Node) AppendText(str string) {
sendAction(n, widget.SetText)
}
-// THESE TWO FUNCTIONS ARE TERRIBLY NAMED AND NEED TO BE FIXED
-// 5 seconds worth of ideas:
-// Value() ?
-// Progname() Reference() ?
-// 2024/01/13 the names are starting to grow on me and make it clearer to code against
-
+// should get the reference name used for programming and debugging
/*
-// get a string from the widget
-func (n *Node) GetText() string {
- if ! n.Ready() { return "" }
- return widget.GetString(n.value)
-}
-
-// 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)
-}
+TODO: ensure these are unique and make a way to look them up
+myButton = myGroup.NewButton("hit ball", nil).SetName("HIT")
+myButton.GetName() should return "HIT"
+n = Find("HIT") should return myButton
*/
-
-// should get the reference name used for programming and debugging
func (n *Node) SetProgName(s string) *Node {
if !n.Ready() {
return n
@@ -198,12 +179,6 @@ func (n *Node) SetProgName(s string) *Node {
return n
}
-/*
-TODO: ensure these are unique and make a way to look them up
-myButton = myGroup.NewButton("hit ball", nil).SetName("HIT")
-myButton.GetName() should return "HIT"
-n = Find("HIT") should return myButton
-*/
func (n *Node) GetProgName() string {
if !n.Ready() {
return ""
@@ -211,19 +186,6 @@ func (n *Node) GetProgName() string {
return n.progname
}
-/*
-func commonCallback(n *Node) {
- // TODO: make all of this common code to all the widgets
- // This might be common everywhere finally (2023/03/01)
- if (n.Custom == nil) {
- log.Log(CHANGE, "Not Running n.Custom(n) == nil")
- } else {
- log.Log(CHANGE, "Running n.Custom(n)")
- n.Custom()
- }
-}
-*/
-
func (n *Node) Margin() *Node {
if !n.Ready() {
return n
@@ -368,17 +330,6 @@ func (n *Node) Window(title string) *Node {
*/
/*
-func (n *Node) Add(str string) {
- log.Log(GUI, "gui.Add() value =", str)
-
- n.value = str
-
- // inform the toolkits
- sendAction(n, widget.Add)
-}
-*/
-
-/*
func (n *Node) SetNext(w int, h int) {
n.NextW = w
n.NextH = h
@@ -406,7 +357,6 @@ func alphaOnly(s string) bool {
}
return true
}
-*/
func normalizeInt(s string) string {
// reg, err := regexp.Compile("[^a-zA-Z0-9]+")
@@ -419,3 +369,4 @@ func normalizeInt(s string) string {
log.Log(GUI, "normalizeInt() s =", clean)
return clean
}
+*/