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: 

ThumbsUpDownButton

Is there a way to set the value of the thumbsupdownbutton?? Let's say that content comes up that was set to thumbsup before. Can i set the button to reflect that it has already been set?
0 Kudos
2 REPLIES 2
RokuKevin
Visitor

Re: ThumbsUpDownButton

Yes. You need to respond to the button events and keep track of the setting in the user's feed or registry...

Example:

screen = CreateObject("roSpringboardScreen")
' Your code to setup springboard page

'Get cur_rating from your feed.. set to zero below as example
cur_rating = 0
screen.AddThumbsUpDownButton(4,cur_rating)

screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roSpringboardScreenEvent"
if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
if msg.GetIndex() = 4 then ' thumbsupdownbutton
thumbRating = msg.GetData()
if thumbRating = 1
if cur_rating = 1
print "already thumbs up"
else
print "change to thumbs up"
cur_rating = 1
'send rating to user's feed
endif
else if thumbRating = -1
if cur_rating = -1
print "already thumbs down"
else
print "change to thumbs down"
'send rating to user's feed
endif
endif
endif
' process other buttons
endif
' process other events for springboard
endif
end while


0 Kudos

Re: ThumbsUpDownButton

Kevin,

Thank you for your response. I will give that a try.
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.