Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
babuhari123
Visitor

Max how many buttons can added in rospringboardscreen?

Hi
Max how many buttons can added in rospringboardscreen?

actually my problem is when iam adding 6 buttons in rospringboardscreen it displayng only five buttons how to display all 6 buttons

please reply...........................

Thanks in advance
Hari
0 Kudos
4 REPLIES 4
KentL
Visitor

Re: Max how many buttons can added in rospringboardscreen?

According to the docs, you can use a max of 5 buttons. The screen seems to just ignore any additional if you try to add more.

Up to 5 user-defined buttons may be displayed. Buttons are displayed in the order they are added and always appear in a fixed region of the screen


I too would like the option to have more in some cases.
0 Kudos
germix
Visitor

Re: Max how many buttons can added in rospringboardscreen?

You can show more than 5 buttons.

If you do a "More Options" button, catch Buttons's Event, do a screen.ClearButtons() and Add more.

Actually I'm using a script to manage button pages...


Function ShowButtons()

'Define functions
obj = {
defineButton: defineButton
prepareButtons: prepareButtons
renderButtons: renderButtons

ButtonIdx: []
ButtonFnc: []
ButtonTxt: []
ButtonOrd: []

Count: 0
}

return obj

End Function

Function defineButton(param1, param2)
m.ButtonOrd.Push(param1)
m.ButtonTxt.Push(param2)
m.Count = m.Count+1
End Function

Function prepareButtons()
' Calculate total pages
if m.Count < 6
float_pages = 1
int_pages = 1
else
float_pages = (m.Count / 4)
int_pages = int(m.Count / 4)
end if

diff_pages = float_pages - int_pages
if(diff_pages > 0) and (diff_pages < 1)
int_pages = int_pages + 1
end if

n = 1
j = 1
m.ButtonFnc[1] = []
m.ButtonIdx[1] = []

for i = 0 to m.Count-1

if (int_pages > 1)
if (n > 1 and n < int_pages)
' Show three options
if (j < 3)
m.ButtonIdx[n].Push("Less Options")
m.ButtonFnc[n].Push(98)
end if

m.ButtonFnc[n].Push(m.ButtonOrd[i])
m.ButtonIdx[n].Push(m.ButtonTxt[i])

if (j > 3)
m.ButtonIdx[n].Push("More Options")
m.ButtonFnc[n].Push(99)
j = 1
n = n + 1
m.ButtonIdx[n] = []
m.ButtonFnc[n] = []
end if

else if (n = 1)
' Show four options
m.ButtonIdx[n].Push(m.ButtonTxt[i])
m.ButtonFnc[n].Push(m.ButtonOrd[i])

if (j > 3)
m.ButtonIdx[n].Push("More Options")
m.ButtonFnc[n].Push(99)
j = 1
n = n + 1
m.ButtonIdx[n] = []
m.ButtonFnc[n] = []
end if

else
' Show four options
if (j = 2)
m.ButtonIdx[n].Push("Less Options")
m.ButtonFnc[n].Push(98)
end if

m.ButtonIdx[n].Push(m.ButtonTxt[i])
m.ButtonFnc[n].Push(m.ButtonOrd[i])
end if
else

' Show five options
m.ButtonIdx[n].Push(m.ButtonTxt[i])
m.ButtonFnc[n].Push(m.ButtonOrd[i])

end if
j = j + 1
end for

end function

function renderButtons(screen, page)
screen.ClearButtons()
for i = 0 to m.ButtonIdx[page].count()-1
screen.AddButton(m.ButtonFnc[page][i], m.ButtonIdx[page][i])
end for
end function


Example: How to use it


Function Springboard()
screen = CreateObject("roSpringBoard")
port = CreateObject("roMessagePort")

screen.SetMessagePort(port)

buttons = ShowButtons()

buttons.defineButton(1, "View video")
buttons.defineButton(2, "View Trailer")
buttons.defineButton(3, "Add to wishlist")
buttons.defineButton(4, "Show synopsis")
buttons.defineButton(5, "Coupon Redeem")
buttons.defineButton(6, "Option 6")
buttons.defineButton(7, "Option 7")
buttons.defineButton(8, "Option 8")
buttons.defineButton(9, "Option 9")
buttons.defineButton(10, "Option 10")

buttons.prepareButtons()

page = 1
buttons.renderButtons(screen, page)

screen.Show()

while true
msg = wait(0, screen.GetMessagePort())
if(msg.isButtonPressed())
if (i = 98)
' Less Options
page = page - 1
buttons.renderButtons(screen, page)
else if (i = 99)
' More Options
page = page + 1
buttons.renderButtons(screen, page)
end if
end if
end while
end function


I hope this helps 😉

NOTE: This script allows manage up to 6 pages... i don't need more than 3.
0 Kudos
destruk
Binge Watcher

Re: Max how many buttons can added in rospringboardscreen?

It's still 5 buttons at a time.
0 Kudos
germix
Visitor

Re: Max how many buttons can added in rospringboardscreen?

I know, but you can manage more than 5 buttons and much people don't know this is possible
0 Kudos