| 1 | // Demo code for the Button primitive. |
| 2 | package main |
| 3 | |
| 4 | import "github.com/rivo/tview" |
| 5 | |
| 6 | func main() { |
| 7 | app := tview.NewApplication() |
| 8 | button := tview.NewButton("Hit Enter to close").SetSelectedFunc(func() { |
| 9 | app.Stop() |
| 10 | }) |
| 11 | button.SetBorder(true).SetRect(0, 0, 22, 3) |
| 12 | if err := app.SetRoot(button, false).EnableMouse(true).Run(); err != nil { |
| 13 | panic(err) |
| 14 | } |
| 15 | } |