-
Notifications
You must be signed in to change notification settings - Fork 1
/
y2kpos.go
36 lines (29 loc) · 789 Bytes
/
y2kpos.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
//import "github.com/gdamore/tcell"
import (
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
modal := tview.NewModal().
SetText("Do you want to quit the application?").
AddButtons([]string{"Quit", "Cancel"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
if buttonLabel == "Quit" {
app.Stop()
}
})
form := tview.NewForm().
AddInputField("Username", "", 20, nil, nil).
AddPasswordField("Password", "", 20, '*', nil).
AddButton("Login", func() {
app.SetRoot(modal, false).SetFocus(modal).Run();
}).
AddButton("Exit", func() {
app.Stop()
})
form.SetBorder(true).SetTitle("Login").SetTitleAlign(tview.AlignLeft)
if err := app.SetRoot(form, true).SetFocus(form).Run(); err != nil {
panic(err)
}
}