namlu
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018
07:01 AM
Navigation: How to skip a row or menu item
Hi all,
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?
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?
6 REPLIES 6
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018
02:35 PM
Re: Navigation: How to skip a row or menu item
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.
You can probably use the field"itemUnfocused" so you know which direction the user is navigating and determine the appropriate item to jump to.
aspiring
namlu
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018
04:24 PM
Re: Navigation: How to skip a row or menu item
Hi @joetesta,
Thank you for your response.
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.
Thank you for your response.
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.
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018
08:05 AM
Re: Navigation: How to skip a row or menu item
dam it i wrote the code example then this forum told me to log in again and everything I wrote is lost 😞
aspiring
namlu
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018
05:27 PM
Re: Navigation: How to skip a row or menu item
Argh!!! So frustrating. Thanks @joetesta, I appreciate the effort.
If you do have the time, can you please try to repost?
If you do have the time, can you please try to repost?
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2018
07:35 AM
Re: Navigation: How to skip a row or menu item
yes sorry was meaning to do this last night before I fell asleep,
in init()
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 ?
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 ?
aspiring
namlu
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2018
07:02 PM
Re: Navigation: How to skip a row or menu item
Awesome, thank you @joetesta! I'll give it a go and let you know how it goes.
I'll have each item be able to react as the list of menu items could vary.
I'll have each item be able to react as the list of menu items could vary.