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. --- combobox.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'combobox.go') diff --git a/combobox.go b/combobox.go index 9d55ed3..0659be1 100644 --- a/combobox.go +++ b/combobox.go @@ -53,7 +53,17 @@ func (c *Combobox) InsertBefore(what string, before int) (err error) { return nil } -// TODO Delete +// Delete removes the given item from the Combobox. +func (c *Combobox) Delete(index int) error { + c.lock.Lock() + defer c.lock.Unlock() + + if c.created { + return c.sysData.delete(index) + } + c.initItems = append(c.initItems[:index], c.initItems[index + 1:]...) + return nil +} // Selection returns the current selection. func (c *Combobox) Selection() string { -- cgit v1.2.3