1
0
mirror of https://github.com/br0xen/termbox-util.git synced 2024-11-25 23:03:13 +00:00

Merge branch 'master' of gogs.bullercodeworks.com:brian/termbox-util

This commit is contained in:
Brian Buller 2016-02-24 17:18:54 -06:00
commit ad7e3807a0

View File

@ -148,6 +148,16 @@ func (i *Menu) GetSelectedIndex() int {
return -1
}
// SetSelectedIndex sets the selection to setIdx
func (i *Menu) SetSelectedIndex(idx int) {
if idx < 0 {
idx = 0
} else if idx >= len(i.options) {
idx = len(i.options) - 1
}
i.SetSelectedOption(&i.options[idx])
}
// SetSelectedOption sets the current selected option to v (if it's valid)
func (i *Menu) SetSelectedOption(v *MenuOption) {
for idx := range i.options {