iOS Question Tab bar controller - Tab item click/change

Rory Mapstone

Member
Licensed User
Longtime User
Hi,

Does anyone know how I can call a sub or function when a tab bar item is clicked or changed?

Regards
 

Rory Mapstone

Member
Licensed User
Longtime User
Handle this event:
B4X:
Sub Page1_BarButtonClick (Tag As String)
  
End Sub

Hi,

I still can't manage to catch that event. I am trying to get Scan_BarButtonClick to fire. I initialise the pages in the sub AddTab.
I have the following code in a code module:

B4X:
Public Sub showQdough
    AddTabBarController("Qdough", 2, Main.App)
    AddTab("layout1", "Random", "iconstatus_useraccepted.png", "iconstatus_useraccepted.png")
    AddTab("layout2", "Scan", "iconstatus_useraccepted.png", "iconstatus_useraccepted.png")
    
    tbc.SelectedIndex = 0
   
End Sub
Sub AddTabBarController(name As String, size As Int, App As Application)
    tbc.Initialize(name)
    App.KeyController = tbc
    l.Initialize
End Sub
Sub AddTab (lo As String, name As String, picutreName As String, selectedPictureName As String)
    Dim icon,selectedIcon As Bitmap
    Dim tbi As TabBarItem
   
    tbcPage.Initialize(name)
    tbcPage.title = name
    tbcPage.RootPanel.LoadLayout(lo)

    If (picutreName <> Null) Then
        icon.Initialize(File.DirAssets, picutreName)
    End If
    If (selectedPictureName <> Null) Then
        selectedIcon.Initialize(File.DirAssets, selectedPictureName)
    End If
   
    If Not (tbi.IsInitialized) Then
        tbi.Initialize(name, icon, selectedIcon)
    End If
   
    If tbc.IsInitialized Then
        tbcPage.TabBarItem = tbi
        l.Add(tbcPage)
        tbc.Pages = l
    End If
End Sub

Sub Scan_BarButtonClick(Tag As String)
    Log("Test")
End Sub
 
Upvote 0
Top