这是我能够重现该问题的最小片段。
Sub Main()
u = getStringFromKeyboard("Enter username")
p = getStringFromKeyboard("Enter password")
End Sub
Function getStringFromKeyboard(message = "" As String) As String
result = ""
port = CreateObject("roMessagePort")
screen = CreateObject("roKeyboardScreen")
screen.SetMessagePort(port)
screen.SetDisplayText(message)
screen.AddButton(1, "OK")
screen.Show()
while true
print "waiting..."
msg = wait(0, port)
print "done waiting"
if type(msg) = "roKeyboardScreenEvent" then
if msg.GetIndex() = 1 then
result = screen.GetText()
exit while
end if
end if
end while
screen.Close()
return result
End Function
Roku 将正确提示输入用户名,但会在提示输入密码之前退出主菜单。调试输出表明应用程序在第二次调用 wait() 时出现故障:
waiting...
done waiting
waiting...
这是 SDK v4.1 和 OS v4.2.1006。
有人知道发生了什么吗?