brightscript屏幕组件(1)

本文详细介绍了屏幕组件的创建与配置,包括文字屏幕和海报屏幕,并阐述了事件处理器的作用和屏幕组件事件类型,如按钮点击和屏幕关闭事件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

屏幕组件

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   为事件处理器 




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值