...

Source file src/github.com/rivo/tview/demos/list/main.go

Documentation: github.com/rivo/tview/demos/list

     1  // Demo code for the List primitive.
     2  package main
     3  
     4  import (
     5  	"github.com/rivo/tview"
     6  )
     7  
     8  func main() {
     9  	app := tview.NewApplication()
    10  	list := tview.NewList().
    11  		AddItem("List item 1", "Some explanatory text", 'a', nil).
    12  		AddItem("List item 2", "Some explanatory text", 'b', nil).
    13  		AddItem("List item 3", "Some explanatory text", 'c', nil).
    14  		AddItem("List item 4", "Some explanatory text", 'd', nil).
    15  		AddItem("Quit", "Press to exit", 'q', func() {
    16  			app.Stop()
    17  		})
    18  	if err := app.SetRoot(list, true).EnableMouse(true).Run(); err != nil {
    19  		panic(err)
    20  	}
    21  }
    22  

View as plain text