Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
johnmarsden
Level 7

Button focus on SpringboardScreen not staying consistent

I saw this thread already, but it's pretty old: https://forums.roku.com/viewtopic.php?t=28280

I have 4 buttons on the roSpringboardScreen. I want to toggle the caption of the 3rd one... so it's like:

Option 1
Option 2 
Toggle Button Off
Option 4

And you could have that change to be "Toggle Button On" without changing the selection/focus index.

I have allowUpdates(true) and useStableFocus(true) enabled. My current method is to do screen.clearButtons(), then add all of the buttons again.

Currently, I have different code numbers for the two toggles, e.g.: addButton(30, "Toggle Button Off") vs addButton(35, "Toggle Button On").. I thought that might be part of the problem, but it doesn't appear to be. I tried using the same numbers and it had no effect.

Is this even possible or am I missing something?
0 Kudos
2 Replies
Roku Employee
Roku Employee

Re: Button focus on SpringboardScreen not staying consistent

"johnmarsden" wrote:
Is this even possible or am I missing something?


I just gave a quick try and it worked for me.

   if btnPressed = MyToggleButton
       screen.UseStableFocus(true)
       screen.AllowUpdates(false)
       screen.ClearButtons()
       AddMyButtons(screen)
       screen.AllowUpdates(true)
       screen.Show()
   end if
0 Kudos
johnmarsden
Level 7

Re: Button focus on SpringboardScreen not staying consistent

Ohhh! You have to turn it off before clearing buttons and then turn it back on.

I thought it was a flag that indicated whether or not you wanted layout changes to affect cursor position in general. That worked. Thanks!
0 Kudos