enable() and disable()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-10 20:04:51 -06:00
parent d617973bfe
commit 1a31a687d6
4 changed files with 68 additions and 3 deletions

View File

@ -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()
}

View File

@ -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
}

View File

@ -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

View File

@ -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,