屏幕组件
1. roParagrahpScreen(文字屏幕)
facade = CreateObject("roParagraphScreen")
m.port = CreateObject("roMessagePort")
facade.SetMessagePort(m.port)
facade.AddParagraph("please wait...")
facade.AddButton(1,"Return")
facade.Show() 'display
创建屏幕 设置屏幕样式
while true
msg = wait(100, facade.GetMessagePort())
'print "=====";type(timer)
'The channel will exit while time is out.
if timer.totalmilliseconds() > 2000 then
print "timeout exceeded"
exit while
end if
if type(msg) = "roParagraphScreenEvent" then
if msg.isButtonPressed() =1 then
if msg.GetIndex() = 1 then
print "We will return."
goto posterScreen
exit while
end if
print msg.Getindex()
else if msg.isScreenClosed()=1 then
print "screen closed"
exit while
end if
end if
end while
事件处理器:facade屏幕通过m.port获得Event(isParagraphSrceenEvent) 通过wait 等待并接收 event 并处理对应的event
roParagraphScreenEvent
The roParagraphScreen sends the roParagraphScreenEvent with the following predicates that indicate its valid event types:
isButtonPressed() as Boolean
A button on the screen was selected.
GetIndex() as Integer
Returns the ID of the button which was selected (the first parameter to AddButton).
isScreenClosed() as Boolean
The screen was closed and is no longer displayed to the user.
2.roPosterscreen(海报屏幕)
port = CreateObject("roMessagePort")
poster = CreateObject("roPosterScreen")
poster.SetBreadcrumbText("[location1]", "[location2]")
poster.SetMessagePort(port)
list = CreateObject("roArray", 10, true)
For i = 0 To 10
o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = "[Title]"
o.ShortDescriptionLine1 = "[ShortDescriptionLine1]"
o.ShortDescriptionLine2 = "[ShortDescriptionLine2]"
o.Description = ""
o.Description = "[Description] "
o.Rating = "NR"
o.StarRating = "75"
o.ReleaseDate = "[<mm/dd/yyyy]"
o.Length = 5400
o.Categories = []
o.Categories.Push("[Category1]")
o.Categories.Push("[Category2]")
o.Categories.Push("[Category3]")
o.Actors = []
o.Actors.Push("[Actor1]")
o.Actors.Push("[Actor2]")
o.Actors.Push("[Actor3]")
o.Director = "[Director]"
list.Push(o)
End For
poster.SetContentList(list)
poster.Show()
While True
msg = wait(0, port)
If msg.isScreenClosed() Then
return -1
Else If msg.isListItemSelected()
print "idx: ";msg.GetIndex()
End If
End While
End function
关联数组 o 储存了节目的信息 并把它赋值给 list数组 通过setContentList方法把内容添加到屏幕
while ... end while 为事件处理器