From 91c9533709f0011f0e34dd19420eda9341cf8102 Mon Sep 17 00:00:00 2001 From: Graham Clark Date: Sun, 26 Jul 2020 23:57:08 -0400 Subject: [PATCH] Don't panic - get the size by rendering the child --- widgets/withscrollbar/withscrollbar.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/widgets/withscrollbar/withscrollbar.go b/widgets/withscrollbar/withscrollbar.go index 3d2cca3..308bc5f 100644 --- a/widgets/withscrollbar/withscrollbar.go +++ b/widgets/withscrollbar/withscrollbar.go @@ -197,9 +197,11 @@ func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid. return w.w.Render(size, focus, app) } - box, ok := size.(gowid.IRenderBox) + var box gowid.IRenderBox + var ok bool + box, ok = size.(gowid.IRenderBox) if !ok { - panic(gowid.WidgetSizeError{Widget: w, Size: size, Required: "gowid.IRenderBox"}) + box = w.always.Render(size, focus, app) } ecols := box.BoxColumns() - 1 var x int