iOS Question BarButton text change

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this sub to replace the text of a toolbar button based on its tag:
B4X:
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)
       Exit
     End If
   Next
   Page1.ToolbarButtons = buttons
End Sub
 
Upvote 0

MikeH

Well-Known Member
Licensed User
Longtime 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

MikeH

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

dieterp

Active Member
Licensed User
Longtime 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
Top