summaryrefslogtreecommitdiff
path: root/setText.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-19 02:56:10 -0600
committerJeff Carr <[email protected]>2024-01-19 02:56:10 -0600
commitd4891c4d58380a81275d315151c2abc58ca1f291 (patch)
treeac274458682a23dda64d2fd2e12cca00d49e2222 /setText.go
parentb15369d85df247a460f0c0c18ac9578c79ca51a3 (diff)
cleanup andlabs
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'setText.go')
-rw-r--r--setText.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/setText.go b/setText.go
index eb09640..611f2c6 100644
--- a/setText.go
+++ b/setText.go
@@ -9,6 +9,34 @@ import (
"go.wit.com/widget"
)
+// This will set the visable name for widgets that
+// have text displayed that is not editable by the user
+// For example, a button, window, group, checkbox
+func (n *Node) SetLabel(label string) *Node {
+ switch n.WidgetType {
+ case widget.Checkbox:
+ n.label = label
+ case widget.Button:
+ n.label = label
+ case widget.Label:
+ n.label = label
+ case widget.Group:
+ n.label = label
+ case widget.Window:
+ n.label = label
+ default:
+ }
+
+ n.changed = true
+ log.Log(CHANGE, "SetLabel() value =", label)
+
+ // inform the toolkits
+ sendAction(n, widget.SetText)
+ return n
+}
+
+// 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