Merge pull request #104 from dorileo/fix-next-control

NextControl also considers parent's visibility
This commit is contained in:
Vladimir Markelov 2018-09-12 12:56:22 -07:00 committed by GitHub
commit b25f59a7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,7 +213,21 @@ func getLinearControlList(parent Control, fn func(Control) bool) []Control {
// that has tab-stop feature on. Used by library when processing TAB key
func NextControl(parent Control, curr Control, next bool) Control {
fnTab := func(c Control) bool {
return c.TabStop() && c.Visible() && c.Enabled()
isVisible := func() bool {
ctrl := c.Parent()
for ctrl != nil {
if !ctrl.Visible() {
return false
}
ctrl = ctrl.Parent()
}
return c.Visible()
}
return c.TabStop() && isVisible() && c.Enabled()
}
linear := getLinearControlList(parent, fnTab)