From 14aaad6be38d6ec23ac6b14d76496f8a38676597 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 15 Feb 2014 18:14:43 -0500 Subject: Added Combobox.Delete() and Listbox.Delete() and added some TODOs. --- listbox.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'listbox.go') 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 -- cgit v1.2.3