iOS Question BarButton text change


B4X founder
Staff member
Licensed User
You can use this sub to replace the text of a toolbar button based on its tag:
Sub ReplaceBarButtonText(Tag As String, NewText As String)
   Dim buttons As List = Page1.ToolbarButtons
   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)
     End If
   Page1.ToolbarButtons = buttons
End Sub
Upvote 0


Well-Known Member
Licensed User
Is there a simpler way of doing this? I only have one toolbar button and I want to change its text or visibility.

Thanks :)
Upvote 0


Well-Known Member
Licensed User
Great, the 2nd option worked a treat. Thanks Erel.
Upvote 0


Active Member
Licensed User
Is it possible to do the following:

1) Open a page, hide the back button and set a TopLeftButton to some new value
2) Perform some operation (Like display a Tableview) and then click the TopLeftButton to return to the same page I was on (Remove the Tableview)
3) Remove the TopLeftButton and then display the back button with the original 'back' link that the page opened with
Upvote 0