-
-
Notifications
You must be signed in to change notification settings - Fork 590
InputField
rivo edited this page Jan 17, 2018
·
6 revisions
A one line InputField:
Code:
package main
import (
"github.com/gdamore/tcell"
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
inputField := tview.NewInputField().
SetLabel("Enter a number: ").
SetFieldWidth(10).
SetAcceptanceFunc(tview.InputFieldInteger).
SetDoneFunc(func(key tcell.Key) {
app.Stop()
})
if err := app.SetRoot(inputField, true).SetFocus(inputField).Run(); err != nil {
panic(err)
}
}