diff options
Diffstat (limited to 'basicDropdown.go')
| -rw-r--r-- | basicDropdown.go | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/basicDropdown.go b/basicDropdown.go index fbc5137..075cd29 100644 --- a/basicDropdown.go +++ b/basicDropdown.go @@ -1,31 +1,31 @@ /* - A Labeled Dropdown widget: +A Labeled Dropdown widget: - ----------------------------- - | | | - | Food: | <dropdown> | - | | | - ----------------------------- +----------------------------- +| | | +| Food: | <dropdown> | +| | | +----------------------------- - This being a 'Basic Dropdown', the dropdown names must be unique +This being a 'Basic Dropdown', the dropdown names must be unique */ package gadgets -import ( +import ( + "go.wit.com/gui" "go.wit.com/log" - "go.wit.com/gui/gui" ) type BasicDropdown struct { - ready bool - name string + ready bool + name string - parent *gui.Node // parent widget - l *gui.Node // label widget - d *gui.Node // dropdown widget + parent *gui.Node // parent widget + l *gui.Node // label widget + d *gui.Node // dropdown widget - value string - label string + value string + label string Custom func() } @@ -39,36 +39,47 @@ func (d *BasicDropdown) Get() string { // Returns true if the status is valid func (d *BasicDropdown) Ready() bool { - if d == nil {return false} + if d == nil { + return false + } return d.ready } func (d *BasicDropdown) AddText(s string) { - if ! d.Ready() {return} + if !d.Ready() { + return + } log.Log(INFO, "BasicDropdown.AddText() =", s) d.d.AddText(s) return } func (d *BasicDropdown) SetText(s string) { - if ! d.Ready() {return} + if !d.Ready() { + return + } log.Log(INFO, "BasicDropdown.SetText() =", s) d.d.SetText(s) return } func (d *BasicDropdown) String() string { - if ! d.Ready() {return ""} + if !d.Ready() { + return "" + } log.Log(INFO, "BasicDropdown.String()", d.d.String()) return d.d.String() } func (d *BasicDropdown) SetLabel(value string) bool { - if ! d.Ready() {return false} + 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} @@ -80,10 +91,10 @@ func (d *BasicDropdown) Set(value string) bool { */ func NewBasicDropdown(p *gui.Node, name string) *BasicDropdown { - d := BasicDropdown { + d := BasicDropdown{ parent: p, - name: name, - ready: false, + name: name, + ready: false, } // various timeout settings |
