From 5fd6365352f07334177f90ce5d5f6bb986cc2cfc Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Sun, 14 Jan 2018 13:50:58 +0100 Subject: [PATCH] Flex must call Box's Draw() function first. Fixes #26 --- demos/flex/main.go | 1 + flex.go | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demos/flex/main.go b/demos/flex/main.go index d2b7da6..f1cdc51 100644 --- a/demos/flex/main.go +++ b/demos/flex/main.go @@ -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) } diff --git a/flex.go b/flex.go index 6c46212..3437cee 100644 --- a/flex.go +++ b/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?