List changed event was not fired when SetCurrentItem() was called. Fixes #315

This commit is contained in:
Oliver 2019-07-11 11:37:27 +01:00
parent 0e689965bb
commit f63eca142c
1 changed files with 4 additions and 3 deletions

View File

@ -95,13 +95,14 @@ func (l *List) SetCurrentItem(index int) *List {
if index < 0 {
index = 0
}
l.currentItem = index
if index != l.currentItem && l.changed != nil {
item := l.items[l.currentItem]
l.changed(l.currentItem, item.MainText, item.SecondaryText, item.Shortcut)
item := l.items[index]
l.changed(index, item.MainText, item.SecondaryText, item.Shortcut)
}
l.currentItem = index
return l
}