mirror of https://github.com/rivo/tview.git
Flex must call Box's Draw() function first. Fixes #26
This commit is contained in:
parent
677c227861
commit
5fd6365352
|
@ -14,6 +14,7 @@ func main() {
|
|||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Middle (3 x height of Top)"), 0, 3, false).
|
||||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Bottom (5 rows)"), 5, 1, false), 0, 2, false).
|
||||
AddItem(tview.NewBox().SetBorder(true).SetTitle("Right (20 cols)"), 20, 1, false)
|
||||
flex.SetBorder(true)
|
||||
if err := app.SetRoot(flex, true).SetFocus(flex).Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
7
flex.go
7
flex.go
|
@ -79,15 +79,14 @@ func (f *Flex) AddItem(item Primitive, fixedSize, proportion int, focus bool) *F
|
|||
|
||||
// Draw draws this primitive onto the screen.
|
||||
func (f *Flex) Draw(screen tcell.Screen) {
|
||||
f.Box.Draw(screen)
|
||||
|
||||
// Calculate size and position of the items.
|
||||
|
||||
// Do we use the entire screen?
|
||||
if f.fullScreen {
|
||||
f.x = 0
|
||||
f.y = 0
|
||||
width, height := screen.Size()
|
||||
f.width = width
|
||||
f.height = height
|
||||
f.SetRect(0, 0, width, height)
|
||||
}
|
||||
|
||||
// How much space can we distribute?
|
||||
|
|
Loading…
Reference in New Issue