Skip to content

SetBackgroundColor draws over grid #362

@ghost

Description

When i set the background color after creating a grid, the entire terminal gets the color and i can't see the grid anymore.

package main

import (
        "github.com/rivo/tview"
        "github.com/gdamore/tcell"
)

func main() {
        newPrimitive := func(text string) tview.Primitive {
                return tview.NewTextView().
                        SetTextAlign(tview.AlignCenter).
                        SetText(text)
        }
        songList := newPrimitive("songs")
        songInfo := newPrimitive("info")
        grid := tview.NewGrid().
                SetRows(-1, 5).
                SetColumns(0).
                SetBorders(true).
                AddItem(songList, 0, 0, 1, 1, 0, 0, false).
                AddItem(songInfo, 1, 0, 1, 1, 0, 0, false).
                SetBackgroundColor(tcell.ColorDefault)


        if err := tview.NewApplication().SetRoot(grid, true).SetFocus(grid).Run(); err != nil {
                panic(err)
        }
}

Seizing the opportunity. I'm learning programming right now and i started with Go and tview. I made a function that lists all the songs in a folder, prints and play the songs in sequence. How do i execute this function inside the songList primitive in this grid? I want the song list printed there.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions