mirror of https://github.com/rivo/tview.git
This commit is contained in:
parent
ad9e2501de
commit
f34fb2a4b3
13
list.go
13
list.go
|
@ -340,6 +340,12 @@ func (l *List) SetSelectedFunc(handler func(int, string, string, rune)) *List {
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSelectedFunc returns the function set with [List.SetSelectedFunc] or nil
|
||||||
|
// if no such function was set.
|
||||||
|
func (l *List) GetSelectedFunc() func(int, string, string, rune) {
|
||||||
|
return l.selected
|
||||||
|
}
|
||||||
|
|
||||||
// SetDoneFunc sets a function which is called when the user presses the Escape
|
// SetDoneFunc sets a function which is called when the user presses the Escape
|
||||||
// key.
|
// key.
|
||||||
func (l *List) SetDoneFunc(handler func()) *List {
|
func (l *List) SetDoneFunc(handler func()) *List {
|
||||||
|
@ -419,6 +425,13 @@ func (l *List) GetItemCount() int {
|
||||||
return len(l.items)
|
return len(l.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetItemSelectedFunc returns the function which is called when the user
|
||||||
|
// selects the item with the given index, if such a function was set. If no
|
||||||
|
// function was set, nil is returned. Panics if the index is out of range.
|
||||||
|
func (l *List) GetItemSelectedFunc(index int) func() {
|
||||||
|
return l.items[index].Selected
|
||||||
|
}
|
||||||
|
|
||||||
// GetItemText returns an item's texts (main and secondary). Panics if the index
|
// GetItemText returns an item's texts (main and secondary). Panics if the index
|
||||||
// is out of range.
|
// is out of range.
|
||||||
func (l *List) GetItemText(index int) (main, secondary string) {
|
func (l *List) GetItemText(index int) (main, secondary string) {
|
||||||
|
|
Loading…
Reference in New Issue