Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
owen777
Level 7

MarkupGrid bug if content's length smaller than numColumns

Hey,

I just want to repot a bug of MarkupGrid. Let's assume I have a content of 3 items I want to display horizontally. Because I want to have the focused item always centered, I set focusColumn=2, numColumns=5 and a proper translation to center the component. That's the initially rendered component:
https://drive.google.com/file/d/1QN0i7EYDEdGdv5OCmHDSYmj5J62qR3JK/preview

The desired behaviour is to have visible two items after the first one in the initial state. It works properly when the content's length is bigger than numColumns value:
https://drive.google.com/file/d/1AjluVN-D-aHAXNnkgTukt7x6qwQ_AC0T/preview[/url:3nufm22l]


Please confi...
0 Kudos
3 Replies
speechles
Level 7

Re: MarkupGrid bug if content's length smaller than numColumns

Can you pad with blanks to get the length you need? Use opacity="0" and focusable="false" on the blanks and stick them at the start or end or combination of the two. Then they are there to get your positioning correct(work around firmware limitations) but serve no other purpose. When doing your maths you will need to account for these blanks(know how many are at the start to subtract) to get your true place on the grid in relation to a spot in a list that corresponds to said grid. But I am sure you know that. ^_^
0 Kudos
owen777
Level 7

Re: MarkupGrid bug if content's length smaller than numColumns

"speechles" wrote:
Can you pad with blanks to get the length you need? Use opacity="0" and focusable="false" on the blanks and stick them at the start or end or combination of the two. Then they are there to get your positioning correct(work around firmware limitations) but serve no other purpose. When doing your maths you will need to account for these blanks(know how many are at the start to subtract) to get your true place on the grid in relation to a spot in a list that corresponds to said grid. But I am sure you know that. ^_^

The problem is that MarkupGrid doesn't respect "focusable" property - creating empty content hacks the bug, but these new empty tiles are focusable. I was trying to avoid them to be focused by extending the MarkupGrid and handling left/right buttons when trying to reach an empty tile and it works, but only for single press - if user presses and holds an arrow button, empty tiles will be reached because of checking m.top.focusedItem is updating only after stopping scrolling MarkupGrid...
0 Kudos
speechles
Level 7

Re: MarkupGrid bug if content's length smaller than numColumns

I would say try visible="false" in place of focusable="false" but that may still give the same issue. Worth a shot. Since visibility is false maybe it won't focus on them. Maybe?! Who the H E (double hockey sticks) knows? Bueller? Bueller?... lol... Some(Most?!) of this Roku stuff is try your own tests before you trust any documentation. We all know this by now or else you will learn this eventually. Smiley Happy
...conversely....
You can also bounce them if they attempt to focus on your blanks. It might look weird. Use the animateToItem instead of the jump. So it slides them back(or forward) to where you want them to be. If the blanks are set to invisible(visible="false") it will look like they can set focus into nowhere-land but then once they stop pressing keys. The app then moves focus back correctly. It might look jarring to them. But eventually they realize not to move outside the realm of what they see and be comfortable that when they do they are naturally(via animateToItem) moved back on course.
0 Kudos