2018-01-03 20:13:32 +00:00
|
|
|
// Demo code for the Frame primitive.
|
2017-12-27 15:05:00 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-10-18 12:15:57 +00:00
|
|
|
"github.com/gdamore/tcell/v2"
|
2017-12-27 15:05:00 +00:00
|
|
|
"github.com/rivo/tview"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := tview.NewApplication()
|
|
|
|
frame := tview.NewFrame(tview.NewBox().SetBackgroundColor(tcell.ColorBlue)).
|
|
|
|
SetBorders(2, 2, 2, 2, 4, 4).
|
|
|
|
AddText("Header left", true, tview.AlignLeft, tcell.ColorWhite).
|
|
|
|
AddText("Header middle", true, tview.AlignCenter, tcell.ColorWhite).
|
|
|
|
AddText("Header right", true, tview.AlignRight, tcell.ColorWhite).
|
|
|
|
AddText("Header second middle", true, tview.AlignCenter, tcell.ColorRed).
|
|
|
|
AddText("Footer middle", false, tview.AlignCenter, tcell.ColorGreen).
|
|
|
|
AddText("Footer second middle", false, tview.AlignCenter, tcell.ColorGreen)
|
2020-03-27 17:41:44 +00:00
|
|
|
if err := app.SetRoot(frame, true).EnableMouse(true).Run(); err != nil {
|
2017-12-27 15:05:00 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|