Forum Discussion

bathejasumeet's avatar
11 years ago

Problem refreshing the roAppManager in roPosterScreen

I am building an app wherein I have set up an roPosterScreen, and on isListItemFocused() event, I am resetting the theme of the roAppManager.
However, I had a problem wherein the theme wasn't being set properly with the code

channel_index=msg.GetIndex()
app_theme_aa=get_theme_aa(channel_index)
app1.setTheme(app_theme_aa)
poster.Show()


I included an image_canvas,and I replaced the above code with

channel_index=msg.GetIndex()
app_theme_aa=get_theme_aa(channel_index)
image_canvas.setLayer(0,[])
image_canvas.show()
app1.setTheme(app_theme_aa)
poster.Show()


The app works fine on the left-right direction key presses, however, whenever I press the UP key after isListItemFocused() event gets fired, the app hangs
It exits in the other case.
What could be a solution to this problem ? Any help would be appreciated.
Regards,
Batheja Sumeet

1 Reply

  • I don't think that themes were intended to be changed in the middle of an application. Depending on what theme attribute(s) you're trying to change, and for what components, it may or may not work, and may require various kludges for them to work.

    Here's an example showing how to change the theme attributes on an roPosterScreen:

    Sub Main ()
    displayUI ()
    End Sub

    Function displayUI () As Void
    contentList = [
    {ShortDescriptionLine1: "Red"},
    {ShortDescriptionLine1: "Green"},
    {ShortDescriptionLine1: "Blue"},
    ]
    port = CreateObject ("roMessagePort")
    ui = CreateObject ("roPosterScreen")
    ui.SetMessagePort (port)
    ui.SetContentList (contentList)
    ui.Show ()
    While True
    msg = Wait (0, port)
    If Type (msg) = "roPosterScreenEvent"
    If msg.IsScreenClosed ()
    Exit While
    Else If msg.IsListItemFocused ()
    index = msg.GetIndex ()
    If index = 0
    changeTheme ({BackgroundColor: "#FF0000"})
    Else If index = 1
    changeTheme ({BackgroundColor: "#00FF00"})
    Else If index = 2
    changeTheme ({BackgroundColor: "#0000FF"})
    EndIf
    EndIf
    EndIf
    End While
    End Function

    Function changeTheme (theme As Object) As Void
    ui = CreateObject ("roImageCanvas")
    ui.SetLayer (0, {Color: "#000000"})
    ui.Show ()
    Sleep (1)
    CreateObject ("roAppManager").SetTheme (theme)
    End Function


    I can't comment on why your UP key isn't working because you haven't posted any code for that.