diff options
-rw-r--r-- | form.go | 2 | ||||
-rw-r--r-- | layout.go | 12 |
2 files changed, 12 insertions, 2 deletions
@@ -356,8 +356,6 @@ func (fb *FormBase) Run() int { defer invalidateDescendentBorders() } - fb.clientComposite.focusFirstCandidateDescendant() - fb.started = true fb.startingPublisher.Publish() @@ -292,6 +292,8 @@ func applyLayoutResults(results []LayoutResult, stopwatch *stopwatch) error { defer stopwatch.Stop(subject) } + var form Form + for _, result := range results { if len(result.items) == 0 { continue @@ -318,6 +320,16 @@ func applyLayoutResults(results []LayoutResult, stopwatch *stopwatch) error { continue } + if form == nil { + if form = window.Form(); form != nil { + defer func() { + if focusedWindow := windowFromHandle(win.GetFocus()); focusedWindow == nil || focusedWindow == form || focusedWindow.Form() != form { + form.AsFormBase().clientComposite.focusFirstCandidateDescendant() + } + }() + } + } + widget := window.(Widget) oldBounds := widget.BoundsPixels() |