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: 
evilmax17
Visitor

When is it valid/invalid to change the theme?(force repaint)

I'm noticing that sometimes when I try to change the theme, the changes don't seem to occur.

Sub initTheme()

app = CreateObject("roAppManager")
theme = CreateObject("roAssociativeArray")

'Create a noticeably different theme each time this function is called.
theme.OverhangOffsetHD_X = itostr( RND(1000) )

theme.OverhangOffsetHD_Y = "25"
theme.OverhangSliceHD = "pkg:/images/Overhang_Background_HD.png"
theme.OverhangLogoHD = "pkg:/images/Overhang_Logo_HD.png"
app.SetTheme(theme)

print "Theme changed."

theme = invalid
app = invalid

End Sub

For example, If I call the above function in response to roPosterScreen::isListItemFocused, nothing changes. If I call initTheme after creating and showing another roPosterScreen, the changes DO occur.

Are there valid/invalid times to change the theme?
My Roku Channels:
Viddler - viddler.com
Tested Fan - tested.com | Jamie & Adam
This is my next - theverge.com
1080p Showcase - RIP
Whiskey Media - RIP
======================
http://www.binarymoustache.com
0 Kudos
9 REPLIES 9
RokuKevin
Visitor

Re: When is it valid/invalid to change the theme?

Try calling the screen's .Show() method again after changing the theme to make it take effect.

--Kevin
0 Kudos
evilmax17
Visitor

Re: When is it valid/invalid to change the theme?

"RokuKevin" wrote:
Try calling the screen's .Show() method again after changing the theme to make it take effect.

--Kevin

Nada. No difference.
My Roku Channels:
Viddler - viddler.com
Tested Fan - tested.com | Jamie & Adam
This is my next - theverge.com
1080p Showcase - RIP
Whiskey Media - RIP
======================
http://www.binarymoustache.com
0 Kudos
TheEndless
Channel Surfer

Re: When is it valid/invalid to change the theme?

"RokuKevin" wrote:
Try calling the screen's .Show() method again after changing the theme to make it take effect.

--Kevin

In my experience, calling .Show() again doesn't actually invalidate the screen for some reason, so it doesn't cause a redraw, but it's been awhile since I tried it last, so that may have changed.

jbrave apparently accomplishes it in his Soundcloud app by showing and immediately hiding an roOneLineDialog (fast enough that it never actually draws, but causes the poster screen to redraw). That's more of a hack than a solution, really, but it could work in your situation if calling .Show() doesn't work.
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
renojim
Community Streaming Expert

Re: When is it valid/invalid to change the theme?

I remember going through this quite a while back. I have a comment in my code that says, "this is here to make sure the theme change takes effect". Unfortunately the next two lines are commented out, but I think that's because they were rolled into the function above the comment. The two lines were:
screen.SetFocusedListItem(i) ' where i was the current focused list item
screen.Show()

I'd be interested to see if it works for you.

Edit: In looking over different versions of the code, those two lines seem to come and go, so they may or may not help.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
evilmax17
Visitor

Re: When is it valid/invalid to change the theme?

"TheEndless" wrote:
jbrave apparently accomplishes it in his Soundcloud app by showing and immediately hiding an roOneLineDialog (fast enough that it never actually draws, but causes the poster screen to redraw). That's more of a hack than a solution, really, but it could work in your situation if calling .Show() doesn't work.

This ended up doing the trick. I'd still like to see a "force repaint" parameter for screen.Show() if repainting isn't guaranteed, but this will do for now.

Sub repaintScreen()
dialog = CreateObject("roOneLineDialog")
dialog.Show()
dialog.Close()
dialog = invalid
End Sub

Thanks all!
My Roku Channels:
Viddler - viddler.com
Tested Fan - tested.com | Jamie & Adam
This is my next - theverge.com
1080p Showcase - RIP
Whiskey Media - RIP
======================
http://www.binarymoustache.com
0 Kudos
RokuKevin
Visitor

Re: When is it valid/invalid to change the theme?

The "force repaint" behavior is an intended side effect for screen.Show().

I've filed a bug for this not working as expected.

--Kevin
0 Kudos
evilmax17
Visitor

Re: When is it valid/invalid to change the theme?

"RokuKevin" wrote:
The "force repaint" behavior is an intended side effect for screen.Show().

I've filed a bug for this not working as expected.

--Kevin

I know I should be patient and wait for the 2.9 SDK docs, but my curiosity is getting the better of me. 😛

Do you know if this has been addressed in the upcoming release? If so, are there any details that we should be aware of?

Thanks!
My Roku Channels:
Viddler - viddler.com
Tested Fan - tested.com | Jamie & Adam
This is my next - theverge.com
1080p Showcase - RIP
Whiskey Media - RIP
======================
http://www.binarymoustache.com
0 Kudos
RokuKevin
Visitor

Re: When is it valid/invalid to change the theme?(force repa

This issue has not been addressed in the upcoming v2.9 patch.

--Kevin
0 Kudos
evilmax17
Visitor

Re: When is it valid/invalid to change the theme?(force repa

"RokuKevin" wrote:
This issue has not been addressed in the upcoming v2.9 patch.

--Kevin

Blahhhhhhhhhhhhhhhhh.

Thanks for the heads up though, as always.
My Roku Channels:
Viddler - viddler.com
Tested Fan - tested.com | Jamie & Adam
This is my next - theverge.com
1080p Showcase - RIP
Whiskey Media - RIP
======================
http://www.binarymoustache.com
0 Kudos