VikR0001
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018
01:49 PM
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
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
13 REPLIES 13
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018
03:02 PM
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:
and HomeScene.brs this:
hope this helps!
Joe
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
mkdir1995
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
10:16 AM
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
VikR0001
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
10:20 AM
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?
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
11:21 AM
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")
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
VikR0001
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
11:23 AM
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?
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
11:25 AM
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.
There can be other things that make it invisible such as opacity = 0 or something else displayed over the top of it.
aspiring
mkdir1995
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
12:22 PM
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!)
VikR0001
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
12:52 PM
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?
mkdir1995
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2018
01:12 PM
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.