mirror of
https://github.com/br0xen/termbox-util.git
synced 2024-11-22 13:33:15 +00:00
Merge branch 'master' of gogs.bullercodeworks.com:brian/termbox-util
This commit is contained in:
commit
ad7e3807a0
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user