diff options
| -rw-r--r-- | basicCombobox.go | 16 | ||||
| -rw-r--r-- | basicDropdown.go | 8 | ||||
| -rw-r--r-- | basicEntry.go | 25 | ||||
| -rw-r--r-- | oneLiner.go | 22 |
4 files changed, 68 insertions, 3 deletions
diff --git a/basicCombobox.go b/basicCombobox.go index 30946f3..01b1f6d 100644 --- a/basicCombobox.go +++ b/basicCombobox.go @@ -46,6 +46,18 @@ func (d *BasicCombobox) Ready() bool { return d.ready } +func (d *BasicCombobox) Enable() { + if d == nil {return} + if d.d == nil {return} + d.d.Enable() +} + +func (d *BasicCombobox) Disable() { + if d == nil {return} + if d.d == nil {return} + d.d.Disable() +} + func (d *BasicCombobox) Add(value any) { if ! d.Ready() {return} log.Log(INFO, "BasicCombobox.Add() =", value) @@ -128,8 +140,8 @@ func NewBasicCombobox(p *gui.Node, name string) *BasicCombobox { d.l = p.NewLabel(name) d.d = p.NewCombobox("") d.d.Custom = func() { - d.value = d.Get() - log.Log(INFO, "BasicCombobox.Custom() user changed value to =", d.value) + d.value = d.d.GetText() + log.Warn("BasicCombobox.Custom() user changed value to =", d.value) if d.Custom != nil { d.Custom() } diff --git a/basicDropdown.go b/basicDropdown.go index 6e8888a..78af8bd 100644 --- a/basicDropdown.go +++ b/basicDropdown.go @@ -48,10 +48,16 @@ func (d *BasicDropdown) Add(value string) { return } +func (d *BasicDropdown) SetLabel(value string) bool { + if ! d.Ready() {return false} + log.Log(INFO, "BasicDropdown.SetLabel() =", value) + d.l.SetText(value) + return true +} func (d *BasicDropdown) Set(value string) bool { if ! d.Ready() {return false} log.Log(INFO, "BasicDropdown.Set() =", value) - d.l.SetText(value) + d.d.SetText(value) d.value = value return true } diff --git a/basicEntry.go b/basicEntry.go index 0fe247f..e65fde3 100644 --- a/basicEntry.go +++ b/basicEntry.go @@ -38,6 +38,28 @@ func (n *BasicEntry) Set(value string) *BasicEntry { return n } +func (n *BasicEntry) Enable() { + log.Log(INFO, "BasicEntry.Enable()") + if (n.v != nil) { + n.v.Enable() + } +} + +func (n *BasicEntry) Disable() { + log.Log(INFO, "BasicEntry.Disable()") + if (n.v != nil) { + n.v.Disable() + } +} + +func (n *BasicEntry) SetLabel(value string) *BasicEntry { + log.Log(INFO, "BasicEntry.SetLabel() =", value) + if (n.l != nil) { + n.l.Set(value) + } + return n +} + func NewBasicEntry(p *gui.Node, name string) *BasicEntry { d := BasicEntry { parent: p, @@ -50,6 +72,9 @@ func NewBasicEntry(p *gui.Node, name string) *BasicEntry { d.v.Custom = func() { d.value = d.v.S log.Log(INFO, "BasicEntry.Custom() user changed value to =", d.value) + if d.Custom != nil { + d.Custom() + } } return &d diff --git a/oneLiner.go b/oneLiner.go index 5f186d3..5661d75 100644 --- a/oneLiner.go +++ b/oneLiner.go @@ -38,6 +38,28 @@ func (n *OneLiner) Set(value string) *OneLiner { return n } +func (n *OneLiner) SetLabel(value string) *OneLiner { + log.Log(INFO, "OneLiner.SetLabel() =", value) + if (n.l != nil) { + n.l.Set(value) + } + return n +} + +func (n *OneLiner) Enable() { + log.Log(INFO, "OneLiner.Enable()") + if (n.v != nil) { + n.v.Show() + } +} + +func (n *OneLiner) Disable() { + log.Log(INFO, "OneLiner.Disable()") + if (n.v != nil) { + n.v.Hide() + } +} + func NewOneLiner(n *gui.Node, name string) *OneLiner { d := OneLiner { p: n, |
