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

isRemoteKeyPressed() not working in roPosterScreenEvent

Hi,
 
port = CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
screen.SetListStyle("arced-landscape")
While (true)
msg = wait(0, screen.GetMessagePort())
if msg <> invalid AND type(msg) = "roPosterScreenEvent" then
if (msg.isListFocused())
'condition goes here
else if(msg.isRemoteKeyPressed())

print "Returns the ID of the remote key which was pressed." ;msg.GetIndex()
end if
end if

when i am pressing remote key nothing will print in debug, control not goes here why ? or isRemoteKeyPressed() not working in case of posterScreenevent case.
Please help.

Thanks
(C.P.jamloki)
0 Kudos
3 REPLIES 3
cpjamloki
Visitor

Re: isRemoteKeyPressed() not working in roPosterScreenEvent

Guys if you have any idea please share.
Actually by dafault poster screen category shown as :

category1< category2

but there is no sign after category 2 (like >)
because when i pressed Right button after category 2 it jumps on category 1. So i want to catch my key index here for block my right button here or put a symbol (like >) here.
0 Kudos
belltown
Roku Guru

Re: isRemoteKeyPressed() not working in roPosterScreenEvent

That's how it's supposed to work. When you get to the last category you wrap around to the first category, and vice-versa.

However, if you really want to confuse your Roku users and do something different when you reach the first or last category, then try something like this:


Sub Main ()
contentList = loadContent ()
ui = CreateObject ("roPosterScreen")
p = CreateObject ("roMessagePort")
ui.SetMessagePort (p)
ui.SetListNames (getNames (contentList))
prevIndex = 0
ui.SetContentList (contentList[prevIndex].Content)
ui.Show ()
While True
msg = Wait (0, p)
If Type (msg) = "roPosterScreenEvent"
If msg.IsListFocused ()
If prevIndex = contentList.Count () - 1 And msg.GetIndex () = 0
displayMessage ("Last Index Plus 1")
ui.SetFocusedList (contentList.Count () - 1)
Else If prevIndex = 0 And msg.GetIndex () = contentList.Count () - 1
displayMessage ("Last Index Minus 1")
ui.SetFocusedList (0)
Else
prevIndex = msg.GetIndex ()
ui.SetContentList (contentList [msg.GetIndex ()].Content)
ui.SetFocusedListItem (0)
End If
EndIf
Else If msg.IsScreenClosed ()
Exit While
End If
End While
End Sub

Function loadContent () As Object
contentList = [ {Name: "< Category 1", Content: [ {ShortDescriptionLine1: "List 1, Item 1"},
{ShortDescriptionLine1: "List 1, Item 2"},
{ShortDescriptionLine1: "List 1, Item 3"},
]
},
{Name: "Category 2", Content: [ {ShortDescriptionLine1: "List 2, Item 1"},
{ShortDescriptionLine1: "List 2, Item 2"},
{ShortDescriptionLine1: "List 2, Item 3"},
]
},
{Name: "Category 3 >", Content: [ {ShortDescriptionLine1: "List 3, Item 1"},
{ShortDescriptionLine1: "List 3, Item 2"},
{ShortDescriptionLine1: "List 3, Item 3"},
]
},
]
Return contentList
End Function

Function getNames (contentList As Object) As Object
names = []
For Each content In contentList
names.Push (content.Name)
End For
Return names
End Function

Function displayMessage (message As String) As Void
ui = CreateObject ("roMessageDialog")
p = CreateObject ("roMessagePort")
ui.SetMessagePort (p)
ui.SetTitle (message)
ui.AddButton (0, "OK")
ui.Show ()
Wait (0, p)
ui.Close ()
End Function
0 Kudos
cpjamloki
Visitor

Re: isRemoteKeyPressed() not working in roPosterScreenEvent

Thanks beltown for reply.

Actually i did same , but arrow signs comes with category inside focus. How to keep these arrow signs (>)outside focus?

How we can remove or ADD these arrow signs which are coming by default with posterScreen.
0 Kudos