NextControl also considers parent's visibility

Whenever running through NextControl() also exclude those controls
which parents are also non visible.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
This commit is contained in:
Leandro Dorileo 2018-09-11 16:58:39 -07:00
parent 89a7c86623
commit 85c09dabf1

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)