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: 
ttown253
Level 7

Can I use the Scene Graph API for just one screen?

Hello,

I have an app that uses the roPosterScreen as my main menu and other legacy SDK screens for all others. I want to use the Scene Graph API's EPGGrid for just one screen in my app. I've got the grid working fine by itself, but when I close it and go back to the main menu, the app exits. I'm showing the EPGGrid using the standard method as described in the docs:


sub showEpgGrid()
screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("rcgridscene")
screen.show()
while true
msg = wait(0, port)
if msg.isScreenClosed() then
return
end if
end while
end sub


My main method shows the main menu and handles screen navigation just like on this page https://sdkdocs.roku.com/display/sdkdoc/Working+with+Screens right under the "Code Structure" title.

The problem is that when the scene graph screen is closed, instead of going back to the main menu, the whole app closes. After doing some debugging, it's also marking my main menu's roPosterScreen as "closed" even though it shouldn't be and the app is exiting prematurely. If I disable the check for "isScreenClosed()" on the main menu, the app will not exit, and the main menu is visible, but will no longer respond to key presses from the remote.

Is it possible to just use Scene Graph for one screen in a legacy app and have all the screens play nice?
0 Kudos
8 Replies
Roku Employee
Roku Employee

Re: Can I use the Scene Graph API for just one screen?

If you don't already have a screen open when your roSGScreen closes, then the app will exit. I would think you could just put up a facade screen:

sub main()
bottomScreen=createobject("roimageCanvas")
bottomScreen.show()
showEpgGrid()



- Joel
0 Kudos
ttown253
Level 7

Re: Can I use the Scene Graph API for just one screen?

I already have an roPosterScreen open underneath the roSGScreen. I tried doing that trick as well, with a facade screen always open under everything, but it didn't help. It's almost like closing the roSGScreen is sending a kill signal to the app as a whole.
0 Kudos
Roku Employee
Roku Employee

Re: Can I use the Scene Graph API for just one screen?

Ok. That is interesting. I'll talk to the SG team and see if this is intended behavior and if there is a work-around.

- Joel
0 Kudos
dlwcarr
Level 7

Re: Can I use the Scene Graph API for just one screen?

I'm having the same problem, where pressing the back button causes the whole app to exit rather than just closing the roSGScreen.

Joel, any updates from the SG team?
0 Kudos
ttown253
Level 7

Re: Can I use the Scene Graph API for just one screen?

I was using some recursion hacks to get around this, but it appears that the latest 7.1 firmware released yesterday has fixed this issue.
0 Kudos
jedashford
Level 7

Re: Can I use the Scene Graph API for just one screen?

Same problem here, but my Roku 4 is still on 7.0. Even if I got mine updated, I wouldn't be able to use this for our customers. If any single user is on 7.0, it would shut down the app when backing out of an roSGScreen. Any way to get around this with 7.0 or any hints on how to force an upgrade of my roku and our customers rokus?
0 Kudos
jedashford
Level 7

Re: Can I use the Scene Graph API for just one screen?

This seems like a pretty serious bug for anyone with a hybrid app. If there is no work around, I probably should stop dev now and wait a few months/year until 7.0 is flushed out of all Roku's or we decide to rebuild the app in the Scene Graph API. Anyone figure out a solution?
0 Kudos
jedashford
Level 7

Re: Can I use the Scene Graph API for just one screen?

Well after alot of trial and error, looks like Joel was right, as usual Smiley Happy

I was using an roPosterScreen as a facade, but apparently this doesn't work with the Scene Graph API, you'll need to use the roimageCanvas.

This does work and wont kill your channel:
    facade = createobject("roimageCanvas")
facade.show()
0 Kudos