diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-02-25 17:27:15 +0100 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-02-25 17:27:15 +0100 |
commit | 431cd50ed4202ecf889258f94c887182050c806a (patch) | |
tree | a307e0d0f0ef7a1ff9f0c0984578b83f1cbbee5f | |
parent | Missed a file in some previous commit (diff) | |
download | wireguard-windows-431cd50ed4202ecf889258f94c887182050c806a.tar.xz wireguard-windows-431cd50ed4202ecf889258f94c887182050c806a.zip |
FormBase: Try to fix scrolling problems with initially focused descendant
-rw-r--r-- | form.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -396,6 +396,21 @@ func (fb *FormBase) Run() int { fb.SetBounds(fb.Bounds()) + // Some widgets perform weird scrolling stunts, when initially focused. + // We try to fix that here and hope for the best. + if hwnd := win.GetFocus(); hwnd != 0 { + if window := windowFromHandle(hwnd); window != nil { + fb.ForEachDescendant(func(widget Widget) bool { + if widget.Handle() != hwnd && widget.SetFocus() == nil { + window.SetFocus() + return false + } + + return true + }) + } + } + var msg win.MSG if processMessageProc != 0 { |