summaryrefslogtreecommitdiff
path: root/basicDropdown.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-18 05:04:18 -0600
committerJeff Carr <[email protected]>2024-01-18 05:04:18 -0600
commita8d95fef8d0879a3e3ecdac76ab4df4fee658fcf (patch)
treed870cdb3147828e2a93bb99a84925b07b719216d /basicDropdown.go
parent76d6da5505900c50b72e3c84e86a521d9bcbc6bd (diff)
lots of syntax changesv0.12.8
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'basicDropdown.go')
-rw-r--r--basicDropdown.go59
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