diff options
Diffstat (limited to 'combobox.go')
| -rw-r--r-- | combobox.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/combobox.go b/combobox.go index 0659be1..241c81e 100644 --- a/combobox.go +++ b/combobox.go @@ -76,7 +76,16 @@ func (c *Combobox) Selection() string { return "" } -// TODO SelectedIndex +// SelectedIndex returns the index of the current selection in the Combobox. It returns -1 either if no selection was made or if text was manually entered in an editable Combobox. +func (c *Combobox) SelectedIndex() int { + c.lock.Lock() + defer c.lock.Unlock() + + if c.created { + return c.sysData.selectedIndex() + } + return -1 +} func (c *Combobox) make(window *sysData) (err error) { c.lock.Lock() |
