Forum Discussion

hugetv's avatar
hugetv
Visitor
11 years ago

How to implement a counter Button in roMessageDialog

problem with 20 buttons display shows only 9

5 Replies

  • destruk's avatar
    destruk
    Streaming Star
    You'd need to use multiple-layer menus, or design a custom roscreen or roimagecanvas to utilize more buttons.
  • destruk's avatar
    destruk
    Streaming Star
    Easiest is multiple dialog screens - have button 8 be 'more choices'
  • this code

    Function ShowMessageDialog_ChooseQuality(episode) As Void
    port = CreateObject("roMessagePort")
    dialog = CreateObject("roMessageDialog")
    dialog.SetMessagePort(port)
    dialog.SetTitle("Choose Links")
    dialog.SetText("Choose the video Links to play")

    count = 1
    for each stream in episode.streams
    dialog.AddButton(count, ValidStr(stream.texturl))
    count = count + 1
    next
    dialog.EnableBackButton(true)
    dialog.Show()
    While True
    dlgMsg = wait(0, dialog.GetMessagePort())
    If type(dlgMsg) = "roMessageDialogEvent"
    if dlgMsg.isButtonPressed()
    index = dlgMsg.GetIndex()
    if index >= 1 and index < count
    dialog.close()
    retval = ShowVideoScreen(episode,episode.streams[index-1].url)
    exit while
    end if
    else if dlgMsg.isScreenClosed()
    exit while
    end if
    end if
    end while
    End Function
  • destruk's avatar
    destruk
    Streaming Star
    I'd just check for more than 9 bitrates being available, and if there were more than 9, I'd split them in some logical order like displaying the top 8 and the lowest available, or every second bitrate, or every third, or something consistent.
    Or -- as suggested, take the first 8, make 9 be more choices, pass the remaining bitrates to it, and loop the thing back to the first page until you're out of options.