Forum Discussion

evilmax17's avatar
evilmax17
Visitor
15 years ago

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?

9 Replies

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

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

    --Kevin

    Nada. No difference.
  • "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.
  • renojim's avatar
    renojim
    Community Streaming Expert
    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
  • "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!
  • The "force repaint" behavior is an intended side effect for screen.Show().

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

    --Kevin
  • "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!
  • This issue has not been addressed in the upcoming v2.9 patch.

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

    --Kevin

    Blahhhhhhhhhhhhhhhhh.

    Thanks for the heads up though, as always.