Figured out how to input data within views

This commit is contained in:
raul 2024-04-07 09:58:34 +02:00
parent faa95c2248
commit 8acdc82081
1 changed files with 7 additions and 2 deletions

View File

@ -22,6 +22,7 @@ func main() {
go counter()
g.Mouse = true
g.Cursor = true
if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
log.Panicln(err)
@ -59,9 +60,13 @@ func layout(g *gocui.Gui) error {
if err != gocui.ErrUnknownView {
return err
}
for i := 0; i < 5; i++ {
fmt.Fprintln(v, "Hola!")
if _, err := g.SetCurrentView("anotherone"); err != nil {
return err
}
v.Title = "Editing"
v.Editable = true
v.Wrap = true
fmt.Fprintln(v, "Holaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!")
}
if v, err := g.SetView("WOW", maxX/2-20, maxY/2, maxX/2+20, maxY/2+5); err != nil {