diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-15 18:14:43 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-15 18:14:43 -0500 |
| commit | 14aaad6be38d6ec23ac6b14d76496f8a38676597 (patch) | |
| tree | acc77ceb440d49ffd23231046558031124f084ad /combobox.go | |
| parent | 3c25b58652b55ee27a8c3c1f09e88a1eb593ca39 (diff) | |
Added Combobox.Delete() and Listbox.Delete() and added some TODOs.
Diffstat (limited to 'combobox.go')
| -rw-r--r-- | combobox.go | 12 |
1 files changed, 11 insertions, 1 deletions
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 { |
