summaryrefslogtreecommitdiff
path: root/listbox.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-15 18:14:43 -0500
committerPietro Gagliardi <[email protected]>2014-02-15 18:14:43 -0500
commit14aaad6be38d6ec23ac6b14d76496f8a38676597 (patch)
treeacc77ceb440d49ffd23231046558031124f084ad /listbox.go
parent3c25b58652b55ee27a8c3c1f09e88a1eb593ca39 (diff)
Added Combobox.Delete() and Listbox.Delete() and added some TODOs.
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