summaryrefslogtreecommitdiff
path: root/listbox.go
diff options
context:
space:
mode:
Diffstat (limited to 'listbox.go')
-rw-r--r--listbox.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/listbox.go b/listbox.go
index 681c972..3c422c2 100644
--- a/listbox.go
+++ b/listbox.go
@@ -53,6 +53,18 @@ func (l *Listbox) InsertBefore(what string, before int) (err error) {
return nil
}
+// Delete removes the given item from the Listbox.
+func (l *Listbox) Delete(index int) error {
+ l.lock.Lock()
+ defer l.lock.Unlock()
+
+ if l.created {
+ return l.sysData.delete(index)
+ }
+ l.initItems = append(l.initItems[:index], l.initItems[index + 1:]...)
+ return nil
+}
+
// TODO Selection
// TODO SelectedIndices