I’m working on a simple Roku Channel and have started implementing a search screen. However, I’m noticing that pressing the back button does not exit my while wait and return to the previous screen. Is there a back button setting that I need to enabled (similar to enabling the back button to exit message dialogs)?
Does your screen have an isScreenClosed() handler that breaks out of the event loop?
There is a close clause, however, it is never being triggered. Is the syntax wrong? It was literally copied and pasted from the sdk example. Partial and full searches are returning event messages as expected.
print "Got Message:"; type(msg)
If (type(msg) = "roSearchScreenEvent") Then
If (msg.isScreenClosed()) Then
print "Search screen closed"
return -1
Else If (msg.isCleared()) Then
print "Search terms cleared"
history.Clear()
Else If (msg.isPartialResult()) Then
print "Partial search: "; msg.GetMessage()
Thanks for the help!
EDIT:
This is within a while loop, just to be clear. ![]()
I’m still not able to trigger the isScreenClosed event using the back button from the search screen. Is there an SDK example project that I can take a look at where this is working? Or any idea why this isn’t working in my code?
Is there maybe a dialog open under your search screen? That can cause this kind of weirdness. Dialogs are meant to be modal and should never be left open in the stack.
That is most likely the case due to my implementation. I have the following procedure for search:
- Open app.
- Press * for more options in a dialog (roMessageDialog)
- If search is selected, open search screen (waiting in dialog loop for returned result from search screen)
So I need to exit the dialog before I can open a search screen if I want the back behavior here?
“kyleabaker” wrote:
That is most likely the case due to my implementation. I have the following procedure for search:
- Open app.
- Press * for more options in a dialog (roMessageDialog)
- If search is selected, open search screen (waiting in dialog loop for returned result from search screen)
So I need to exit the dialog before I can open a search screen if I want the back behavior here?
That’s right.
Thanks for your help Chris. It’ll be a couple days before I’m near my Roku to test these changes, but I’ll follow up if that works.
Off topic, is there any documentation that covers which theme settings apply to the Search screen? I’m apply them settings for roGridScreen layout for the main screen, but none of the styling is applied at all to the Search screen.
“kyleabaker” wrote:
Off topic, is there any documentation that covers which theme settings apply to the Search screen? I’m apply them settings for roGridScreen layout for the main screen, but none of the styling is applied at all to the Search screen.
There’s a column in the theme attribute chart that tells you which apply to which screens. http://sdkdocs.roku.com/display/sdkdoc/roAppManager
Just a quick update. That was indeed the open dialog that was blocking the search screen from going back. Got that working and properly styled! Thanks for the help!
