Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
VikR0001
Visitor

Newbie Q: Understanding How to Bring Up New Screens

I building an app starting from the “Roku Scene Graph – Grid Screen” sample app that comes with the Roku Eclipse Plug-in
 
It opens with this screen (screen #1):



When I click the OK button on the remote, it brings up this screen (screen #2):



Where is the line of code that brings up Screen #2?
 
I’ve been looking for days but haven’t quite figured it out yet. Thanks in advance to all for any info!
 
Best,
 
 
-Vik
0 Kudos
13 REPLIES 13
joetesta
Roku Guru

Re: Newbie Q: Understanding How to Bring Up New Screens

I'm looking at "simple grid with video" example, maybe it's the same or similar enough;

HomeScene.xml has this:

        <field id="rowItemSelected" type="intarray" alwaysnotify="true" alias="GridScreen.rowItemSelected"/>



and HomeScene.brs this:

    m.top.observeField("rowItemSelected", "OnRowItemSelected")



hope this helps!
Joe
aspiring
0 Kudos
mkdir1995
Visitor

Re: Newbie Q: Understanding How to Bring Up New Screens

If you're using the Simple_Grid_with_Details_and_Video example, the part of the code I've been understanding as displaying that second screen is in the HomeScene.brs. anytime an item is selected on the home grid, the details screen will be set to true:

' Row item selected handler
Function OnRowItemSelected()
    ' On select any item on home scene, show Details node and hide Grid
    m.gridScreen.visible = "false"
    m.detailsScreen.content = m.gridScreen.focusedContent
    m.detailsScreen.setFocus(true)
    m.detailsScreen.visible = "true"
End Function
0 Kudos
VikR0001
Visitor

Re: Newbie Q: Understanding How to Bring Up New Screens

Is that all it takes to make a screen visible -- setting its "visible" property to true?
0 Kudos
joetesta
Roku Guru

Re: Newbie Q: Understanding How to Bring Up New Screens

generally you need to instantiate such a screen first, it won't exist just by virtue of being in the channel code.
It could be called into exist either by being a child component of a component that's instantiated, or with something like m.myscreen = createObject("roSGNode","screenID")
aspiring
0 Kudos
VikR0001
Visitor

Re: Newbie Q: Understanding How to Bring Up New Screens

Very good. So after the screen is properly instantiated, can it be displayed just by setting the "visible" property to true?
0 Kudos
joetesta
Roku Guru

Re: Newbie Q: Understanding How to Bring Up New Screens

if its translation places it onscreen and its "visible" value was previously false, then yes.
There can be other things that make it invisible such as opacity = 0 or something else displayed over the top of it.
aspiring
0 Kudos
mkdir1995
Visitor

Re: Newbie Q: Understanding How to Bring Up New Screens

"VikR0001" wrote:
Very good. So after the screen is properly instantiated, can it be displayed just by setting the "visible" property to true?

If you wanted to remove the detail screen and instead show another screen, yep, as long as you set everything up correctly within the content and the XML I don't see why it wouldn't work. Make sure you also include it in the init() function within the .brs file using findNode(). I'm actually attempting to display a new screen as well, depending on the type of video that is clicked on. I've successfully been able to solely display the screen but am still working on setting the new content within it so for now its just empty (the hardest part in my opinion!)
0 Kudos
VikR0001
Visitor

Re: Newbie Q: Understanding How to Bring Up New Screens

Is using the "visible" flag the most common way to reveal a screen? Or are other methods more commonly used?
0 Kudos
mkdir1995
Visitor

Re: Newbie Q: Understanding How to Bring Up New Screens

"VikR0001" wrote:
Is using the "visible" flag the most common way to reveal a screen? Or are other methods more commonly used?

Good question, I'm not really sure. Upon app startup of course there's .show() in the main function, but from what I've seen within the code, I've only noticed alot of screen2.visible = true and screen1.visible = false etc.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.