diff options
| author | Jeff Carr <[email protected]> | 2024-01-11 19:32:40 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-11 19:32:40 -0600 |
| commit | ed951e0234d428298bd6b76b07e371ce2ab3cb60 (patch) | |
| tree | 200c77deef52245e59dc96f591e16843a8125927 /setText.go | |
| parent | 5f6afb8cf8293f819711ccdf791296edfd7ce7d6 (diff) | |
var value anyv0.12.2
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'setText.go')
| -rw-r--r-- | setText.go | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -3,8 +3,6 @@ package gui // Common actions for widgets like 'Enable' or 'Hide' import ( - "errors" - "go.wit.com/log" "go.wit.com/gui/widget" ) @@ -17,32 +15,52 @@ func (n *Node) SetText(text string) *Node { if ! n.hidden { a := newAction(n, widget.SetText) - a.A = n.value + a.Value = n.value sendAction(a) } return n } +/* +func convertString(val any) string { + switch v := val.(type) { + case bool: + n.B = val.(bool) + case string: + n.label = val.(string) + n.S = val.(string) + case int: + n.I = val.(int) + default: + log.Error(errors.New("Set() unknown type"), "v =", v) + } +} +*/ + + func (n *Node) Set(val any) { log.Log(CHANGE, "Set() value =", val) n.value = val + /* + n.value = val switch v := val.(type) { case bool: n.B = val.(bool) case string: - n.Text = val.(string) + n.label = val.(string) n.S = val.(string) case int: n.I = val.(int) default: log.Error(errors.New("Set() unknown type"), "v =", v) } + */ if ! n.hidden { a := newAction(n, widget.Set) - a.A = val + a.Value = n.value sendAction(a) } } |
