MCPcopy Create free account
hub / github.com/cogentcore/core / SetWidgetValue

Method SetWidgetValue

core/switch.go:70–77  ·  view source on GitHub ↗
(value any)

Source from the content-addressed store, hash-verified

68func (sw *Switch) WidgetValue() any { return sw.IsChecked() }
69
70func (sw *Switch) SetWidgetValue(value any) error {
71 b, err := reflectx.ToBool(value)
72 if err != nil {
73 return err
74 }
75 sw.SetChecked(b)
76 return nil
77}
78
79func (sw *Switch) OnBind(value any, tags reflect.StructTag) {
80 if d, ok := tags.Lookup("display"); ok {

Callers

nothing calls this directly

Calls 2

SetCheckedMethod · 0.95
ToBoolFunction · 0.92

Tested by

no test coverage detected