iOS Question TopLeftButton TopRightButton in the title are not displayed

Lakhtin_V

Active Member
Licensed User
Longtime User
I want to have left and right buttons at the top of the window, in the middle part the title
B4X:
Dim bbt1, bbt2 As BarButton
    Page1.Title="GURU"
    bbt1.InitializeText("<Exit.","Exit")
    bbt2.InitializeText("Start>","Start")
    Page1.TopLeftButtons.Add(bbt1)
    Page1.TopRightButtons.Add(bbt2)
The title appears and the buttons on the sides do not
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
Thanks for the advice, I learned how to create Top Right Buttons on the topbar. I successfully created them with the help of the designer and in manual mode. But I do not understand how to set the code that will be executed when I press this button. In your video tutorial I did not find the answer. There is no such example in the user's Guide B4i. I tried to create a procedure like Sub bbt1_click but it does not work.
B4X:
Dim bbt1 as BarButton, bbt2 as BarButton
bbt1.InitializeText("DO","TAGg")
Page1.TopRightButtons=Array(bbt1)

Private Sub TAGg_Click
or
Private Sub TAGg_BarButtonClick
or
Private Sub bbt1_BarButtonClick
or
Private Sub Page_BarButtonClick      ->(from Guide)
or ?
In the design, it is possible. For simple Button I without problem generate Sub for Click event but for the barbaton this option is not found.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
You need to use something like this:
B4X:
' Page1 ToolBar buttons event routine
Private Sub Page1_BarButtonClick (Tag As String)
    Select Tag
    Case "Exit"
        ' your code
    Case "Start"
        ' your code
    End Select
End Sub
Example extracted from the UINavBar example program in the B4i Beginner's Guide SourceCode.
 
Upvote 0
Top