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.