diff options
| author | Jeff Carr <[email protected]> | 2024-01-31 14:02:43 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-31 14:02:43 -0600 |
| commit | a84f361287c8c245365838df03c3f6c0eef1794f (patch) | |
| tree | 46281fb75e8e9f098c8b659eefd57ca513296591 /setText.go | |
| parent | 96ed34f69b91d82a9ded703c43b28063f7508c85 (diff) | |
deprecate SetValue() as confusingv0.18.0
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'setText.go')
| -rw-r--r-- | setText.go | 74 |
1 files changed, 14 insertions, 60 deletions
@@ -36,71 +36,25 @@ 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 { - 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) - - // inform the toolkits - sendAction(n, widget.SetText) - */ - return n -} - -func (n *Node) SetValue(val any) *Node { - if !n.Ready() { - return n - } - - n.value = val + n.value = text n.changed = true - log.Log(CHANGE, "Set() value =", val) - - // inform the toolkits - sendAction(n, widget.Set) - return n -} + log.Log(CHANGE, "SetText() text =", text) -/* -func (n *Node) Set(val any) { - if !n.Ready() { - return - } - - switch v := val.(type) { - case bool: - if widget.GetBool(n.value) == val.(bool) { - // nothing changed - return - } - case string: - if widget.GetString(n.value) == val.(string) { - // nothing changed - return - } - case int: - if widget.GetInt(n.value) == val.(int) { - // nothing changed - return - } + switch n.WidgetType { + case widget.Checkbox: + n.label = text + case widget.Button: + n.label = text + case widget.Label: + n.label = text + case widget.Group: + n.label = text + case widget.Window: + n.label = text default: - log.Error(errors.New("Set() unknown type"), "v =", v) } - n.value = val - n.changed = true - log.Log(CHANGE, "Set() value =", val) - // inform the toolkits sendAction(n, widget.Set) + return n } -*/ |
