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: 
dynamitemedia
Binge Watcher

issues with buttons on regScreen

The regScreen example for some reason shows to add buttons but i cant get them to do anything.

here is some code i tried....

Function displayRegistrationScreen() As Object

regsite = "go to " + m.UrlWebsite
' regscreen.SetMessagePort(CreateObject("roMessagePort"))

port = CreateObject("roMessagePort")
regscreen = CreateObject("roCodeRegistrationScreen")
regscreen.SetMessagePort(port)

regscreen.SetTitle("")
regscreen.AddParagraph("Please link your Roku player to your account by visiting")
regscreen.AddFocalText(" ", "spacing-dense")
regscreen.AddFocalText("From your computer,", "")
regscreen.AddFocalText(regsite, "spacing-dense")
regscreen.AddFocalText("and enter this code to activate:", "spacing-dense")
regscreen.SetRegistrationCode("retrieving code...")
regscreen.AddParagraph("This screen will automatically update as soon as your activation completes")

regscreen.AddButton(1, "Get a new code")
regscreen.AddButton(2, "Back")
regscreen.Show()

'return regscreen

while true
msg = wait(0, regscreen.GetMessagePort())
if msg.isButtonPressed() then
if msg.GetIndex() = 1

print "new code pushed"
return regscreen
exit while
endif
if msg.GetIndex() = 2

print "exit pushed"
exit while
end if
endif

end while

regscreen.Close()

End Function


it seems the issue is once "return regscreen" gets called it makes the buttons useless, you can click them but they wont do anything.

and of course until you click on the "get a new code" button it will just sit at "retrieving code..."
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
21 REPLIES 21
YungBlood
Streaming Star

Re: issues with buttons on regScreen

If I understand your code correctly, I'm guessing it has something to do with your call of displayRegistrationScreen().

You should have that "return regscreen" after the regscreen.show(). Then right after that, there should be an end function.

Then in your calling code, you should have regscreen = displayRegistrationScreen() before your while loop.

Also, I think that shouldn't be a wait 0, you should have it check the site every so often to see if the code has been entered there.

I'm not quite seeing how you are getting the reg code... but try something like this...

sub main()
http = createobject("rourltransfer")
http.seturl("http://www.somesite.com/testcode.cgi?code=" + code)
regscreen = displayRegistrationScreen()
registered = 0
while true
msg = wait(1000, regscreen.GetMessagePort())
if msg.isButtonPressed() then
if msg.GetIndex() = 1
regscreen.close()
http.seturl("http://www.somesite.com/testcode.cgi?code=" + code)
regscreen = displayRegistrationScreen()
else if msg.GetIndex() = 2
exit while
end if
else
if http.gettostring() = "true" then
registered = 1
exit while
end if
end if
end while
regscreen.close()
if registered = 1 then
' do something...
end if
end sub
YungBlood

Bringing more fun to Roku!
0 Kudos
dynamitemedia
Binge Watcher

Re: issues with buttons on regScreen

thanks but i am using the register example, th eonly thing i changed was adding the buttons to do something because the they are shown how to add them in the example.

but they aren't coded to actually do anything

I will look this over in more detail what you posted to see if its something that will work, but at first glance i am not sure it will withe the way the register example is set up.

and again i really appreciate your time to look this over and add your solution, i will look it over a lot more in the morning 😄
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
YungBlood
Streaming Star

Re: issues with buttons on regScreen

I left out the code for the displayRegistrationScreen() function... but I am suggesting having it there... just have your loop outside. 🙂
YungBlood

Bringing more fun to Roku!
0 Kudos
dynamitemedia
Binge Watcher

Re: issues with buttons on regScreen

I do not want to change any of the example that the docs have in the register example, i just want to use the buttons that they show. There has to be a way to add functionality to those buttons in that example without rewriting any code.

i thank you for your help, but i just want to get this working without any rewriting of the functions if possible. this should be a simple thing and not sure why it was excluded in the docs :?

If i cant get some help on this maybe will have to consider changing it more similar to what you showing here but i do not use the same method as you do , with calling a cgi file etc... i use the register example exactly as is cause except for the buttons it works great
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Channel Surfer

Re: issues with buttons on regScreen

What SDK example are you using, because neither the 2.7 nor 2.6 examples look like yours? It looks like you tried to combine the displayRegistrationScreen() and doRegistration() functions, which is where your problem is occurring. The msg.isButtonPressed() part of the wait loop responds to the button presses, so the code is there, and gets called correctly in the stock sample.
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
dynamitemedia
Binge Watcher

Re: issues with buttons on regScreen

ok yes i see what you mean now endless...

i went back to using the the version from 2.7, i was just trying to get some functionality from those buttons

i get the code etc on the screen... but it is still not doing anything once i am here and i have to hit the home key to get out.

what is missing to make these buttons actually work and not just beep?
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: issues with buttons on regScreen

Based on the original code you posted, the problem could be at least partly due to returning from the function before closing the screen. When you return prematurely like that, you could be left with an open screen, but no event loop to handle your button presses.
0 Kudos
dynamitemedia
Binge Watcher

Re: issues with buttons on regScreen

chris, i went back to using the example exactly as is.

so how do i get the buttons work with the register example in the 2.7 sdk? all they are doing now is beeping and doing nothing i cant go up to get out either
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: issues with buttons on regScreen

To start, you need to add logic to your event loop to handle your new buttons. It looks like you started to do that at one point. Something along the lines of...
if msg.GetIndex() = 0
regscreen.SetRegistrationCode("retrieving code...")
getNewCode = true
exit while
else if msg.GetIndex() = 1
' do something
else if msg.GetIndex() = 2
' do something else
endif
0 Kudos