| 1 | // Demo code for the Button primitive. |
| 2 | package mainscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview/demos/button`/ |
| 3 | |
| 4 | import "github.com/darkhz/tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/" |
| 5 | |
| 6 | func mainscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview/demos/button`/main().() { |
| 7 | app := tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewApplicationscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewApplication().() |
| 8 | button := tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewButtonscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewButton().("Hit Enter to close").SetSelectedFuncscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Button#SetSelectedFunc().(func() { |
| 9 | app.Stopscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Application#Stop().() |
| 10 | }) |
| 11 | button.SetBorderscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetBorder().(true).SetRectscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetRect().(0, 0, 22, 3) |
| 12 | if err := app.SetRootscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Application#SetRoot().(button, false).EnableMousescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Application#EnableMouse().(true).Runscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Application#Run().(); err != nil { |
| 13 | panic(err) |
| 14 | } |
| 15 | } |