From 60313b7f2537cb47407a38e96e404fe00b5c1716 Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Mon, 1 Jan 2018 17:16:36 +0100 Subject: [PATCH] SetRoot() also sets focus. --- application.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application.go b/application.go index f45b6ae..9b5db65 100644 --- a/application.go +++ b/application.go @@ -212,12 +212,16 @@ func (a *Application) Draw() *Application { // SetRoot sets the root primitive for this application. This function must be // called or nothing will be displayed when the application starts. +// +// It also calls SetFocus() on the primitive. func (a *Application) SetRoot(root Primitive, autoSize bool) *Application { - a.Lock() - defer a.Unlock() + a.Lock() a.root = root a.rootAutoSize = autoSize + a.Unlock() + + a.SetFocus(root) return a }