Practice using coordinates for adding textboxes

This commit is contained in:
raul 2024-04-05 12:11:12 +02:00
parent 5edb80e54a
commit 99c053115e
1 changed files with 11 additions and 2 deletions

View File

@ -27,12 +27,21 @@ func main() {
func layout(g *gocui.Gui) error {
maxX, maxY := g.Size()
if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2); err != nil {
if v, err := g.SetView("hello", maxX/2-20, maxY/2-15, maxX/2+20, maxY/2-5); err != nil {
if err != gocui.ErrUnknownView {
return err
}
fmt.Fprintln(v, "Hello world!")
fmt.Fprintln(v, "This is a reaaaaaaaally long message")
fmt.Fprintln(v, "Hello!")
}
if v, err := g.SetView("anotherone", maxX/2-20, maxY/2, maxX/2+20, maxY/2+2); err != nil {
if err != gocui.ErrUnknownView {
return err
}
fmt.Fprintln(v, "Hola!")
}
return nil
}