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: 

refreshing roAppManager theme in roPosterScreen

I am trying to refresh the roAppManager theme in an roPosterScreen when an roPosterScreen occurs, but however am unable to reset the theme. The theme gets set fine for the first time but when trying to reset it by calling setTheme and then subsequently calling Show method of roPosterScreen. Can anybody please help ? has anyone faced a similar issue before?
0 Kudos
5 REPLIES 5
TheEndless
Channel Surfer

Re: refreshing roAppManager theme in roPosterScreen

You can't dynamically update the theme after the screen has been show without forcing a repaint. In theory, calling .Show() again is supposed to do that, but it doesn't, so you have to trick it. I've found that just creating a new screen, but not showing it will get it to update.
Sub ForceThemeRefresh()
' Simply creating the canvas without ever showing it seems to
' trick the current screen into refreshing...
canvas = CreateObject("roImageCanvas")
canvas.Close()
End Sub

Include the above code in your channel, then call it whenever you want to update the theme for the current screen. No idea why this works, and it's definitely a hack, but...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
belltown
Roku Guru

Re: refreshing roAppManager theme in roPosterScreen

That's almost what I came up with when I replied to his other post asking the exact same question. I had to add in a Sleep (1) when changing the background for an roPosterScreen otherwise there was a weird visual effect when the poster screen background (not the whole screen background, but just the parts of it that could potentially be covered by the poster screen) were changed to the background color first, before the rest of the screen background was changed. I'm not sure either why that works, or if it will continue to work with future firmware updates.
0 Kudos

Re: refreshing roAppManager theme in roPosterScreen

Hi Endless and beltown, the hack worked, thanks. Nonetheless, I think I misconstrued the documentation completely when it said " The roAssociativeArray may be populated manually at runtime with values or the developer can provide and parse an XML file containg the theme using the roXMLElement object. Existing values for attributes will be overwritten by the values provided." under "SetTheme(attributeArray as Object) as Void" on http://sdkdocs.roku.com/display/sdkdoc/ifAppManager and with the doc of roPoster screen "Display or refresh the screen after initial creation or state changes." under "Show() as Boolean" on http://sdkdocs.roku.com/display/sdkdoc/ifPosterScreen#ifPosterScreen-ShowasBoolean, and made a naive attempt to change the theme of the API, which should not be the case as mentioned by beltown on http://forums.roku.com/viewtopic.php?f=34&t=84043 , and thus requires kludges, and sorry for creating a duplicate post, wanted an urgent reply, wont be doing that again.
0 Kudos
belltown
Roku Guru

Re: refreshing roAppManager theme in roPosterScreen

I could see where there could be confusion over whether or not roAppManager can be used to change attributes that you have already set after the initial screen display. It doesn't really say one way or the other in the documentation. When it talks about populating an array manually at run-time, or reading the values from an Xml file, could both mean to be done during program startup, before you get your first screen displayed (which is still considered run-time), or after the program has been running a while with screen attributes already having been set. You can even set attributes from some Xml config file, then over-write them with SetThemeAttribute based on some condition you discover during program startup -- before that first screen gets displayed -- or after the intial screen display. The former case (set the theme before initial screen display) is the one generally used, at least in all the Roku example code that I've seen. The latter case (changing the theme after initial screen display) clearly does not work well without various kludges. Whether that's a "bug" or a "feature" I'm not sure. However, it's been like that for years so I'm not very hopeful that it will get fixed any time soon (or ever).
0 Kudos
TheEndless
Channel Surfer

Re: refreshing roAppManager theme in roPosterScreen

"bathejasumeet" wrote:
made a naive attempt to change the theme of the API, which should not be the case as mentioned by beltown on viewtopic.php?f=34&t=84043

If I'm reading that correctly, I don't think it's accurate. Changing theme attributes at some point after the application has started is definitely supported. One example might be the desire to change the SecondaryOverhangLogo based on the content being displayed (e.g., to display a specific show logo). Typically you would do it immediately prior to showing the screen you want the theme to be different on, but that's not always possible. As you noted, per the documentation, simply calling .Show() again on the screen object should refresh it, but it doesn't, and that's been a bug forever, hence the need for hacks/workarounds.

Note that if you do change a particular theme attribute, and you only want it to apply to the current screen, you'll need to set it back to the original value before you close the screen, otherwise the screen(s) below it in the stack will adopt the same theme change when they return into view.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
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.