Frage

I have a text section on roku that is being cut off due to its length. There are two possible solutions.

  • What would seem to be easist is make the text smaller on this one page.
  • Make the text section scrollable

My page is roParagraphScreen in which I add a paragraph. If I need to pass a value into the theme I am fine with that. I just havent found any property as of yet that handles text size. I also know there is the whole font creation aspect, but that seems like a little much.

Here is the code I am working with

screen = CreateObject("roParagraphScreen")
screen.setMessagePort(port)

themeOpts = {fontSize: 100} 'this is the new code I am thinking as possible solution
setTheme(themeOpts)

if valid(opts.breadcrumb) then
    screen.setBreadcrumbText(opts.breadcrumb, "")
end if

screen.addHeaderText(getCopy().SYSTEM_STATUS_SCREEN.RESULTS_TITLE)

screen.addParagraph(getCopy().SYSTEM_STATUS_SCREEN.SUSTAINED_BANDWIDTH + " " + opts.bandwidthResult.roundedAsString + " MPS")

then in the theme section do something like this

if valid(opts.fontSize) then 
   'change font size

I havent looked into the scrollable text solution yet. Wanted to get some feedback on here first.

War es hilfreich?

Lösung

I couldnt find a way to change font size. So I changed the component to roTextScreen. This allows for overflow and scrolling.

There was another issue I ran into. I dont know the length of the content since its coming from the db. I had to add line breaks. If you dont do this then the down button will not get you to the buttons.

Here is the code

screen = CreateObject("roTextScreen")
screen.setMessagePort(port)

setTheme()

screen.setHeaderText("Header Text")
screen.addText(getCopy().SYSTEM_STATUS_SCREEN.TEXT_1)
screen.addText(getCopy().SYSTEM_STATUS_SCREEN.TEXT_2)

'ensure section is long enough so use can press down button to get to buttons
screen.addText(chr(10))
screen.addText(chr(10))
screen.addText(chr(10))
screen.addText(chr(10))
screen.addText(chr(10))

screen.addButton(1, "Begin") 
screen.show()

while true
    msg = wait(0, screen.getMessagePort())

    if type(msg) = "roTextScreenEvent" 
        if msg.isButtonPressed() then

        end if

        if msg.isScreenClosed() then
            exit while
        end if
    end if
end while
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top