mirror of https://github.com/rivo/tview.git
Added more documentation for the List primitive.
This commit is contained in:
parent
f38d14c988
commit
646df2bd7e
23
list.go
23
list.go
|
@ -15,7 +15,24 @@ type listItem struct {
|
|||
Selected func() // The optional function which is called when the item is selected.
|
||||
}
|
||||
|
||||
// List displays rows of items, each of which can be selected.
|
||||
// List displays rows of items, each of which can be selected. List items can be
|
||||
// shown as a single line or as two lines. They can be selected by pressing
|
||||
// their assigned shortcut key, navigating to them and pressing Enter, or
|
||||
// clicking on them with the mouse. The following key binds are available:
|
||||
//
|
||||
// - Down arrow / tab: Move down one item.
|
||||
// - Up arrow / backtab: Move up one item.
|
||||
// - Home: Move to the first item.
|
||||
// - End: Move to the last item.
|
||||
// - Page down: Move down one page.
|
||||
// - Page up: Move up one page.
|
||||
// - Enter / Space: Select the current item.
|
||||
// - Right / left: Scroll horizontally. Only if the list is wider than the
|
||||
// available space.
|
||||
//
|
||||
// See [List.SetChangedFunc] for a way to be notified when the user navigates
|
||||
// to a list item. See [List.SetSelectedFunc] for a way to be notified when a
|
||||
// list item was selected.
|
||||
//
|
||||
// See https://github.com/rivo/tview/wiki/List for an example.
|
||||
type List struct {
|
||||
|
@ -64,8 +81,8 @@ type List struct {
|
|||
// of the right arrow key.
|
||||
overflowing bool
|
||||
|
||||
// An optional function which is called when the user has navigated to a list
|
||||
// item.
|
||||
// An optional function which is called when the user has navigated to a
|
||||
// list item.
|
||||
changed func(index int, mainText, secondaryText string, shortcut rune)
|
||||
|
||||
// An optional function which is called when a list item was selected. This
|
||||
|
|
Loading…
Reference in New Issue