Forum Discussion

gboudreau's avatar
gboudreau
Channel Surfer
9 years ago

RowList reverts change of focus when changing row title

I started with Simple_Grid_and_Video.zip
In GridScreen.brs, I changed the OnItemFocused() to update the title of the currently selected row in the rowList to the title of the focused item:

        focusedContent = m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1])

if focusedContent <> invalid then
+ rowX = m.rowList.content.getChild(itemFocused[0])
+ rowX.title = focusedContent.title

'set focused content to top interface
m.top.focusedContent = focusedContent


The issue: when I change the selected item in a row, the title changes, but the selection "jumps back" to the previously selected item.
So say I start the app, I see the first item title in the row title "Live Gaming", but if I hit the right arrow once, the title changes to "Let's Get Cookin'", but the selection quickly goes back to the first item (Twitch)... What is happening?

This seems to occur every time the rowX.title changes; if I just change it to a constant string, it doesn't do it, and if I try to change it to show the index of the selected item in the row (itemFocused[1]), then it does the same thing.

Thanks.
  • TheEndless's avatar
    TheEndless
    Channel Surfer
    Do you have an observer set up anywhere else that could be triggered when you update m.top.focusedContent?
  • gboudreau's avatar
    gboudreau
    Channel Surfer
    Indeed, I think this here gets triggered when row.title changes:
    Sub OnChangeContent()
    ? "OnChangeContent "
    m.AlbumsGridScreen.setFocus(true)
    m.loadingIndicator.control = "stop"
    End Sub

    Thanks.
  • TheEndless's avatar
    TheEndless
    Channel Surfer
    How about an observer on RowList.content? If not, it sounds like changing the row title is causing it to reset focus. If that's the case, then you could grab the current itemFocused before updating the title, then call jumpToRowItem immediately after updating the title.