lock_4815162342
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017
01:53 PM
How do you change focus out of a grid to another item?
I am learning SceneGraph and I have been modifying the SimpleGridWithDetailsAndVideo. I am now trying to add a search feature.
In case you are not familiar with this sample project, the screen I am working with, GridScreen.xml is just a grid of items. I have added a ButtonGroup with a search icon button at the top left corner of the screen.
How do I change focus from my grid or RowList to the image at the top? :?:
Do I need to put the grid and button in some parent other than the Group component that they are currently in ? :?:
Thank you for taking the time to read this. Any information that you can provide no matter how minor will be very appreciative. 🙂
In case you are not familiar with this sample project, the screen I am working with, GridScreen.xml is just a grid of items. I have added a ButtonGroup with a search icon button at the top left corner of the screen.
How do I change focus from my grid or RowList to the image at the top? :?:
Do I need to put the grid and button in some parent other than the Group component that they are currently in ? :?:
Thank you for taking the time to read this. Any information that you can provide no matter how minor will be very appreciative. 🙂
2 REPLIES 2
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017
05:24 PM
Re: How do you change focus out of a grid to another item?
I don't know if there may be other (better? easier?) ways to do this but you can certainly add an "onKeyEvent" function in your GridScreen.brs something like this:
(Note: this assumes you've done a findNode on your button to set m.button)
Function OnKeyEvent(key, press) as Boolean
result = false
if press then
if key = "up" and m.button.hasFocus() = false
m.button.setfocus(true)
result = true
else if key = "down" and m.button.hasFocus() = true
m.rowlist.setfocus(true)
result = true
end if
end if
return result
End Function
(Note: this assumes you've done a findNode on your button to set m.button)
aspiring
lock_4815162342
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017
05:46 AM
Re: How do you change focus out of a grid to another item?
Thank you so much. 😄
I tried putting the SetFocus in the init just to test it but it didn't work. Putting it in the OnKeyEvent did the trick.
I am so grateful for such a helpful community. 🙂
I tried putting the SetFocus in the init just to test it but it didn't work. Putting it in the OnKeyEvent did the trick.
I am so grateful for such a helpful community. 🙂