1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-28 13:48:53 +08:00
2020-09-13 21:40:12 -03:00

23 lines
481 B
Go

// Demo code for the Modal primitive.
package main
import (
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
modal := tview.NewModal().
SetText("Search a list").
AddInputText([]string{"Input text:"}).
AddButtons([]string{"Search", "Clear"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
if buttonLabel == "Clear" {
app.Stop()
}
})
if err := app.SetRoot(modal, false).EnableMouse(true).Run(); err != nil {
panic(err)
}
}