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

Need Help with PIN Dialog Screen

Hi,

Can someone tell me why the screen would freeze when clicking the "Cancel" button on the PIN Entry Dialog screen with the function below? I have another PIN screen that works, however, I do not see anything that would cause this problem. After entering in numbers in the PIN Entry and click the "Confirm" button, the screen exits fine. However, I cannot cancel at all. I'm running firmware 3.1. I'm going crazy here.

Function contentPinEntry(videoRating as string) as boolean
requestPIN = checkContentRating(videoRating)
isPasscodeCorrect = CreateObject("roBoolean")
isPasscodeCorrect.SetBoolean(false)

if requestPIN = true then
port = CreateObject("roMessagePort")
pinScreenConfirm = CreateObject("roPinEntryDialog")
pinScreenConfirm.setMessagePort(port)

pinScreenConfirm.AddButton(1, "Confirm")
pinScreenConfirm.AddButton(2, "Cancel")
pinScreenConfirm.SetNumPinEntryFields(4)
pinScreenConfirm.SetTitle("Enter Content Passcode")
pinScreenConfirm.EnableBackButton(true)

pinScreenConfirm.Show()

while(true)
msg = wait(0, port)

if type(msg) = "roPinEntryDialogEvent" then
if msg.isButtonPressed() then
if msg.GetIndex() = 1 then
pinEntered = pinScreenConfirm.Pin()

if Len(pinEntered) = 4 then
if RegRead("contentProtectionPIN") <> invalid then
if pinEntered = RegRead("contentProtectionPIN")
isPasscodeCorrect.SetBoolean(true)
exit while
else
pinScreenConfirm.SetTitle("Incorrect! Please try again.")
end if
end if
else
pinScreenConfirm.SetTitle("Passcode must be four digits in length")
end if
else if msg.GetIndex() = 2 then
pinScreenConfirm.Close()
exit while
else
pinScreenConfirm.Close()
exit while
end if
else if(msg.isScreenClosed()) then
exit while
end if
end if
end while
else
return true
end if

if isPasscodeCorrect.GetBoolean() = true then
return true
else
return false
end if
End Function
0 Kudos
2 REPLIES 2
TheEndless
Channel Surfer

Re: Need Help with PIN Dialog Screen

Are you getting the isButtonPressed event? Have you tried moving the AddButton calls to after the EnableBackButton call? Some screens can be particularly (and unpredictably) sensitive to the order in which their setup methods are called.
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
krh5150
Visitor

Re: Need Help with PIN Dialog Screen

Hi TheEndless,

Thanks for the reply. It was actually something outside of the function. I wasn't closing a background canvas when I should have. Of course, late night programming can do that to you.

Thanks,
Kevin
0 Kudos