From 5706ff427f266a8ae9d67f02b4d4948748e872b0 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 23 Jan 2024 16:51:48 -0600 Subject: SetText() is just SetValue() Signed-off-by: Jeff Carr --- setText.go | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/setText.go b/setText.go index 6f5bedf..74d70a9 100644 --- a/setText.go +++ b/setText.go @@ -3,8 +3,6 @@ package gui // Common actions for widgets like 'Enable' or 'Hide' import ( - "errors" - "go.wit.com/log" "go.wit.com/widget" ) @@ -38,26 +36,29 @@ func (n *Node) SetLabel(label string) *Node { // What "SetText" means depends on the type of widget // should this be a different name? func (n *Node) SetText(text string) *Node { - if !n.Ready() { - return n - } + n.SetValue(text) + /* + if !n.Ready() { + return n + } - if n.String() == text { - // nothing changed - // return n - } - n.value = text - n.changed = true - log.Log(CHANGE, "SetText() value =", text) + if n.String() == text { + // nothing changed + // return n + } + n.value = text + n.changed = true + log.Log(CHANGE, "SetText() value =", text) - // inform the toolkits - sendAction(n, widget.SetText) + // inform the toolkits + sendAction(n, widget.SetText) + */ return n } -func (n *Node) SetValue(val any) { +func (n *Node) SetValue(val any) *Node { if !n.Ready() { - return + return n } n.value = val @@ -66,8 +67,10 @@ func (n *Node) SetValue(val any) { // inform the toolkits sendAction(n, widget.Set) + return n } +/* func (n *Node) Set(val any) { if !n.Ready() { return @@ -100,3 +103,4 @@ func (n *Node) Set(val any) { // inform the toolkits sendAction(n, widget.Set) } +*/ -- cgit v1.2.3