This is ultra-simplified but it works too --
Sub Main()
showChannelSGScreen()
End Sub
Sub showChannelSGScreen()
screen=CreateObject("roSGScreen")
m.port=CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene=screen.CreateScene("KeyboardDialogExample")
screen.show()
While(TRUE)
msg=wait(0,m.port)
msgType=type(msg)
If msgType="roSGScreenEvent"
If msg.isScreenClosed() Return
End If
End While
End Sub
<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->
<component name="KeyboardDialogExample" extends="Scene">
<script type="text/brightscript">
<![CDATA[
Sub init()
m.top.backgroundURI="pkg:/images/rsgde_bg_hd.jpg"
keyboarddialog=createObject("roSGNode","KeyboardDialog")
keyboarddialog.backgroundUri="pkg:/images/rsgde_dlg_bg_hd.9.png"
keyboarddialog.title="Example Keyboard Dialog"
keyboarddialog.buttons=["OK","Cancel"]
keyboarddialog.observeField("text","dbText")
keyboarddialog.observeField("buttonSelected","confirmSelection")
m.top.dialog=keyboarddialog
m.cText="" 'initialize variable for this component
m.cFocused=0 'initialize variable
m.top.setFocus(TRUE)
End Sub
Sub dbText()
Print"Text: "+m.top.dialog.text
m.cText=m.cText+right(m.top.dialog.text,1) 'Grab the right character of the dialog text
If Len(m.top.dialog.text)>40 m.top.dialog.text=Right(m.top.dialog.text,40) 'truncate value for display with a limit of 40 characters
Print"CTEXT:"+m.cText 'Print copied value to screen
End Sub
Sub confirmSelection()
m.cFocused=m.top.dialog.buttonFocused
If m.cFocused=0
Print"OK"
Print"Entry complete, use cText value of: "+m.cText
End If
If m.cFocused=1 Print"Cancel"
End Sub
]]>
</script>
</component>