iOS Question Tab bar controller - Tab item click/change

Discussion in 'iOS Questions' started by Rory Mapstone, Jul 6, 2015.

  1. Rory Mapstone

    Rory Mapstone Member Licensed User

    Hi,

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

    Regards
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Handle this event:
    Code:
    Sub Page1_BarButtonClick (Tag As String)
       
    End Sub
     
  3. Rory Mapstone

    Rory Mapstone Member Licensed User

    Thank you.
     
  4. Rory Mapstone

    Rory Mapstone Member Licensed User

    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:

    Code:
    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 <> NullThen
            icon.Initialize(
    File.DirAssets, picutreName)
        
    End If
        
    If (selectedPictureName <> NullThen
            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
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    I didn't understand that you are using TabBarController. You can handle the Page_Appear event in that case.
     
  6. Rory Mapstone

    Rory Mapstone Member Licensed User

    ok, thank you I will give it a try.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice