Off the top of my head, here is one approach:
you would probably want to have an array of associative arrays:
buttonarray=[{text:"button 1",index:0,selected:true,screenposx:100,screenposy:100}
{text:"button 2",index:1,selected:false,screenposx:100,screenposy:140}
{text:"button3",index:2,selected:falsescreenposx:100,screenposy:180}]
then you would iterate over the list of buttons and set the highlight based on which button is marked true:
for each button in buttonarray
if button.selected then
drawselectedbutton(screen,button.text,button.screenposx,button.screenposy)
focusedbutton=button.index
else
drawunselectedbutton(screen,button.text,button.screenposx,button.screenposy)
end if
end for
where your drawselected/unselected are functions you create to update the buttons with a highlight.
then you would listen for wahtever keypress tells you that the user is moving the focus, and you would iterate through all buttons again to change the selected to false for the others and the selected to true for the newly selected button.
if the select / ok button on the remote is pressed, you would get the index of the selected button and use that in an if/then to determine what function you want to execute.
- Joel
(post edited to correct a syntax error)