Change button text on SpringboardScreen without losing focus

I have a SpringboardScreen with several buttons, some perform toggle functions where I’d like to change the text from “Option On” to “Option Off”. I’ve determined that I can clear the buttons and add them again with correct text, however, the UseStableFocus(true) setting seems to be ignored since the buttons were cleared. Ultimately I would like to change the text of a button without moving off of the selected button. Am I missing a step here?

UseStableFocus() should work, even with clearing and re-adding the buttons. That’s how navigating left and right work. Can you share the code you’re using to reset the buttons?

Below is a skeleton of the code I’m working with. Is this an invalid approach?


	' Code to initialize springboard here
	'....

	springBoard.UseStableFocus(true)

regenerateSpringBoardButtons:
	springBoard.ClearButtons()

	If (isToggledOn = true) Then
		springBoard.AddButton(1,"Option On")
	Else
		springBoard.AddButton(1,"Option Off")
	End If

	springBoard.SetContent(o)
	springBoard.Show()
	While True
		msg = wait(0, port)
		If msg.isScreenClosed() Then
			Return -1
		Elseif msg.isButtonPressed() 
			print "msg: "; msg.GetMessage(); "idx: "; msg.GetIndex()
			idx = msg.GetIndex()

			If (idx = 1) Then
				updateOptionToggleState()
				goto regenerateSpringBoardButtons
			End If
		Endif
	End While

Resolved

For anyone seeing this issue in the future, I’ve actually resolved this issue now by using AllowUpdates() which I wasn’t previously using. You may also notice that I pull the SetContent out of the GoTo loop, that was just because it wasn’t necessary to set each time. See corrected code below:


   ' Code to initialize springboard here
   '....

   springBoard.UseStableFocus(true)
   springBoard.SetContent(o)

regenerateSpringBoardButtons:
   springBoard.AllowUpdates(false)
   springBoard.ClearButtons()

   If (isToggledOn = true) Then
      springBoard.AddButton(1,"Option On")
   Else
      springBoard.AddButton(1,"Option Off")
   End If

   springBoard.AllowUpdates(true)
   springBoard.Show()
   While True
      msg = wait(0, port)
      If msg.isScreenClosed() Then
         Return -1
      Elseif msg.isButtonPressed() 
         print "msg: "; msg.GetMessage(); "idx: "; msg.GetIndex()
         idx = msg.GetIndex()

         If (idx = 1) Then
            updateOptionToggleState()
            goto regenerateSpringBoardButtons
         End If
      Endif
   End While