mirror of
https://github.com/VladimirMarkelov/clui.git
synced 2025-04-28 13:48:50 +08:00
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:
parent
89a7c86623
commit
85c09dabf1
16
ctrlutil.go
16
ctrlutil.go
@ -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
|
// that has tab-stop feature on. Used by library when processing TAB key
|
||||||
func NextControl(parent Control, curr Control, next bool) Control {
|
func NextControl(parent Control, curr Control, next bool) Control {
|
||||||
fnTab := func(c Control) bool {
|
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)
|
linear := getLinearControlList(parent, fnTab)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user