I’m working on a menu item feature where an option may sometimes be locked due to device capabilities (e.g. doesn’t support UHD content). While I’m able to show a lock icon next to the menu item when appropriate, I would like for the menu selector (using a MarkupList for this) to skip over that menu item when it’s locked.
I’ve tried to set the menu item to focusable = false, but that doesn’t seem to work as the user can still navigate over and select it.
Has anyone done something similar that they can share how it was accomplished?
you could observe the markupList’s “itemFocused” field and when it becomes equal to your locked item, set jumpToItem to the next item.
You can probably use the field"itemUnfocused" so you know which direction the user is navigating and determine the appropriate item to jump to.
Would you have to have some sample code for implementing a similiar feature? I’ve discussed this option w colleagues and implementation sounds quite challenging for something that shouldn’t be.
yes sorry was meaning to do this last night before I fell asleep,
in init()
m.markuplist = m.top.findnode("markupListID")
m.markuplist.observeField("itemFocused", "focusChanged")
m.lockedIndex = 3
end sub
sub focusChanged()
itemFocused = m.markuplist.itemFocused
if itemFocused = m.lockedindex
'skip the locked item'
nextItem = invalid
if itemFocused > m.markuplist.itemUnfocused and itemFocused < m.markuplist.content.getChildCount() - 1
nextItem = itemFocused + 1
else if itemFocused < m.markuplist.itemUnfocused and itemFocused > 0
nextItem = itemFocused - 1
end if
if nextItem <> invalid
m.markuplist.jumpToItem = nextItem
end if
end if
end sub
You could add logic to bounce them back one if the locked item is at the end or beginning. You could have an array of locked items and further complicate things.
This is just one way to do it, another way would be for each itemComponent to observe its own focusPercent and have a field to know if it’s “locked” then react by setting it’s parent’s jumpToItem. Don’t know whether it’d be better ?