Sub Main()
'... create facade, sets theme, etc etc
TheValue=RegRead("KeyName","MyChannel") 'read saved registry value
If Type(TheValue)="Invalid" Then
port=CreateObject("roMessagePort")
dialog=CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("Invalid Registry Data")
dialog.SetText("No registry data exists - select OK to save new value")
dialog.AddButton(0,"OK")
dialog.Show()
While TRUE
dlgMsg=Wait(0,port)
If Type(dlgMsg)="roMessageDialogEvent"
If dlgMsg.isButtonPressed()
Print"Button pressed: ";dlgMsg.GetIndex();" ";dlgMsg.GetData()
Exit While
End If
End If
End While
TheValue=CreateObject("roDeviceInfo").GetDisplayType()
RegWrite("KeyName",TheValue,"MyChannel")
End If
'... displays regular screen, loads xml, etc etc etc
End Sub
Function RegRead(key,section=invalid)
If section=invalid section="Default"
sec=CreateObject("roRegistrySection",section)
If sec.Exists(key) Return sec.Read(key)
Return invalid
End Function
Function RegWrite(key,val,section=invalid)
If section=invalid section="Default"
sec=CreateObject("roRegistrySection",section)
sec.Write(key,val)
sec.Flush() 'commit it
End Function
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
We're sorry for this disruption — we’re excited to share what’s next!
For support, visit support.roku.com.