how turn off and on elements on a tabed view

IslandMedic

Member
Licensed User
Longtime User
I am using the tabhost feature to navigate around my app. It took me a bit to figure it out but I managed. Now the problem question I have is that on my initial Page I want to make a label and button visiable or not based on a status flag. I am not having any success. I created the label and button using the designer and then using the program to modify it. Here is the code. Please help if you can. I just know it is going to be something simple and I will feel like an idiot. Thanks in advance for the help.

B4X:
Sub tbhPages_TabChanged
    'everytime the tab is changed this event will be called.
   
   Select tbhPages.CurrentTab
      Case 0:
         ' ok we need to indicate that we are responding or away etc on the main page.
         
         Select status
            Case "Available":
               myRespButt.Visible = False
               myStatus.Text = "RESPONDING"
               myStatus.Visible = True
               
               
            Case "Away":
               
               myRespButt.Visible = True
               myStatus.Text = "Away"
                                        myStatus.Visible = True

            Case "Not Online":
               myRespButt.Visible = False
               myStatus.Text = "OFF Line"
                                        myStatus.Visible = True
               
         End Select   
   
   Case 1:
      Log ("Away")
   
   Case 2:
      Log ("Register")
      myRank.AddAll(Array As String("Chief", "Deputy", "Captain", "Lieutenant", "Fire Fighter", "Rookie"))
   
   End Select
   
End Sub
 

IslandMedic

Member
Licensed User
Longtime User
ok I new it was going to be simple. It turned out that I had put the same elements on two different tabs so it look liked things were just confused. I went in and cleaned things up and it worked. Note to self "spend another 10 min looking before you ask the question"

thanks for the quick response.

Brad
 
Upvote 0
Top