summaryrefslogtreecommitdiff
path: root/combobox.go
diff options
context:
space:
mode:
Diffstat (limited to 'combobox.go')
-rw-r--r--combobox.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/combobox.go b/combobox.go
index ac3523a..571bcba 100644
--- a/combobox.go
+++ b/combobox.go
@@ -2,6 +2,7 @@
package ui
import (
+ "fmt"
"sync"
)
@@ -34,15 +35,21 @@ func NewEditableCombobox(items ...string) *Combobox {
return newCombobox(true, items...)
}
-// Append adds an item to the end of the Combobox's list.
-func (c *Combobox) Append(what string) (err error) {
+// Append adds items to the end of the Combobox's list.
+func (c *Combobox) Append(what ...string) (err error) {
c.lock.Lock()
defer c.lock.Unlock()
if c.created {
- return c.sysData.append(what)
+ for i, s := range what {
+ err := c.sysData.append(s)
+ if err != nil {
+ return fmt.Errorf("error adding element %d in Combobox.Append() (%q): %v", i, s, err)
+ }
+ }
+ return nil
}
- c.initItems = append(c.initItems, what)
+ c.initItems = append(c.initItems, what...)
return nil
}