diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-15 18:27:34 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-15 18:27:34 -0500 |
| commit | 2d97a2446304daa1d57121d13143cce2ceaf69a3 (patch) | |
| tree | 920a6b86d1f405af0ed9e1b0953e50f3ad9f9bad /combobox.go | |
| parent | 8be17f087b0cb1706df837b3f956dcca2ced4568 (diff) | |
Added Combobox.SelectedIndex().
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() |
