iOS Question change top left buttons text

le_toubib

Active Member
Licensed User
Longtime User
hi

i'm using this code to change text:
B4X:
Sub ReplaceBarButtonText(Tag As String, NewText As String)
   Dim buttons As List = page0.TopRightButtons
   For i = 0 To buttons.Size - 1
     Dim bb As BarButton = buttons.Get(i)
     If bb.Tag = Tag Then
       Dim newButton As BarButton
       newButton.InitializeText(NewText, Tag)
       buttons.Set(i, newButton)
       Exit
     End If
   Next

Page0.TopLeftButtons = buttons

End Sub



but i get this error , on the line ( buttons.Set(i, newButton) ) :



what am i doing wrong?
 

le_toubib

Active Member
Licensed User
Longtime User
ok, thanks erel, that was my mistake , my aim is to change the toprightbuttons (the ons i set in the designer)

but i changed the code into :
B4X:
Sub ReplaceBarButtonText(Tag As String, NewText As String)
   Dim buttons As List = Page0.TopRightButtons
        Dim newButton As BarButton
       newButton.InitializeText(NewText, "btn_Scale")
       buttons.Set(2, newButton)
       Page0.TopRightButtons = buttons
End Sub

but i still get the same error.
what am i doing wrong
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…