23 lines
566 B
Go
23 lines
566 B
Go
// Demo code for the List primitive.
|
|
package main
|
|
|
|
import (
|
|
"git.sr.ht/~tslocum/cview"
|
|
)
|
|
|
|
func main() {
|
|
app := cview.NewApplication()
|
|
list := cview.NewList().
|
|
AddItem("List item 1", "Some explanatory text", 'a', nil).
|
|
AddItem("List item 2", "Some explanatory text", 'b', nil).
|
|
AddItem("List item 3", "Some explanatory text", 'c', nil).
|
|
AddItem("List item 4", "Some explanatory text", 'd', nil).
|
|
AddItem("Quit", "Press to exit", 'q', func() {
|
|
app.Stop()
|
|
})
|
|
app.EnableMouse()
|
|
if err := app.SetRoot(list, true).Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|