Added password field to Form demo in presentation.

This commit is contained in:
Oliver 2018-01-12 09:23:53 +01:00
parent a7346b12c6
commit c2bfee0387
2 changed files with 4 additions and 1 deletions

View File

@ -64,6 +64,7 @@ Add your issue here on GitHub. Feel free to get in touch if you have any questio
- v0.4 (2018-01-12)
- `TextView` now accepts color tags with any W3C color (including RGB hex values).
- Support for wide unicode characters.
- v0.3 (2018-01-11)
- Added masking to `InputField` and password entry to `Form`.
- v0.2 (2018-01-10)

View File

@ -20,6 +20,7 @@ const form = `[green]package[white] main
[red]"Administration"[white],
}, [red]0[white], nil).
[yellow]AddCheckbox[white]([red]"On vacation:"[white], false, nil).
[yellow]AddPasswordField[white]([red]"Password:"[white], [red]""[white], [red]10[white], [red]'*'[white], nil).
[yellow]AddButton[white]([red]"Save"[white], [yellow]func[white]() { [blue]/* Save data */[white] }).
[yellow]AddButton[white]([red]"Cancel"[white], [yellow]func[white]() { [blue]/* Cancel */[white] })
tview.[yellow]NewApplication[white]().
@ -34,8 +35,9 @@ func Form(nextSlide func()) (title string, content tview.Primitive) {
AddInputField("Last name:", "", 20, nil, nil).
AddDropDown("Role:", []string{"Engineer", "Manager", "Administration"}, 0, nil).
AddCheckbox("On vacation:", false, nil).
AddPasswordField("Password:", "", 10, '*', nil).
AddButton("Save", nextSlide).
AddButton("Cancel", nextSlide)
f.SetBorder(true).SetTitle("Employee Information")
return "Forms", Code(f, 36, 13, form)
return "Forms", Code(f, 36, 15, form)
}