forked from tslocum/cview
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
659 B
24 lines
659 B
// Demo code for the Form primitive. |
|
package main |
|
|
|
import ( |
|
"git.sr.ht/~tslocum/cview" |
|
) |
|
|
|
func main() { |
|
app := cview.NewApplication() |
|
form := cview.NewForm(). |
|
AddDropDown("Title", []string{"Mr.", "Ms.", "Mrs.", "Dr.", "Prof."}, 0, nil). |
|
AddInputField("First name", "", 20, nil, nil). |
|
AddInputField("Last name", "", 20, nil, nil). |
|
AddPasswordField("Password", "", 10, '*', nil). |
|
AddCheckbox("", "Age 18+", false, nil). |
|
AddButton("Save", nil). |
|
AddButton("Quit", func() { |
|
app.Stop() |
|
}) |
|
form.SetBorder(true).SetTitle("Enter some data").SetTitleAlign(cview.AlignLeft) |
|
if err := app.SetRoot(form, true).Run(); err != nil { |
|
panic(err) |
|
} |
|
}
|
|
|