Your Digital Media Has Never Looked So Good

Topic Author
Posts: 6
Joined: Wed Jul 05, 2017 8:34 am

focus manager like tabIndex for you

Fri Aug 11, 2017 7:50 am

I give on the forum my script for manage tabindex, it's working well for me

function initTabIndex()
    m._tabIndex = []
end function

function addTabIndex(id,targets)
end function

function updateTabIndex(key)
    currentIndex = _getFocusIndex()
    currentItem = m._tabIndex[currentIndex]
    if(currentItem = invalid) then return false
    if(currentItem.targets.DoesExist(key)) then
        target = currentItem.targets.Lookup(key)
        return true
    end if
   return false
end function

function _getFocusIndex()
    for i=0 to m._tabIndex.count()-1
        item = m._tabIndex[i]
        node =
        if(node.focusedChild <> invalid) then
            return i
        end if
    end for
    return invalid
end function

How to use ?
Import the script in your xml
<script type="text/brightscript" uri="pkg:/components/util/UIUtil.brs" />

In your init() you can do something like that : 

in your onKeyEvent :
function onKeyEvent(key as String, press as Boolean) as Boolean
    if press then return updateTabIndex(key)
end function

in this sample, when you have the focus on btnShowPass, when you press left, you swap the focus to btnValidate

Best regards,

Who is online

Users browsing this forum: No registered users and 4 guests