iOS Question ASTabMenu

tariqyounis

Member
Licensed User
Longtime User
I am facing a problem in b4xpages, the problem is that when I go to page "mdlSignup" by pressing the ASTabMenu (index = 1) I go to that page normally. But when I close the Signup page and come back to this page the "Sub ASTabMenu_horizontal_TabClick(index As Int)" is triggered and the sub findUser is executed by itself.
any advice.

by the way if I define the ASTabMenu in the B4XPage_Create section of the page there is no problem, but some times I need to define it in the B4XPage_Appear section then I am facing this problem. I have to define it in the B4XPage_Appear section so I can change the tabs of the menu based on some variables.

TabClick:
Sub ASTabMenu_horizontal_TabClick(index As Int)
    If index = 0 Then
        findUser
    Else
        B4XPages.ShowPage("mdlSignup")
    End If
End Sub
 

tariqyounis

Member
Licensed User
Longtime User
you call on B4XPage_Appear the sub showMenu which rebuilds the menu.
This is unnecessary, put the code in B4XPage_Created and you will see, no more problems.
some times the menu on the main page is not fixed, like for example the menu on the main page depends on the data entered on page2. Based on that when I come back to the main page I would like to see deferent titles on the main menu. this task wont be accomplished if I call ShowMenu from the B4XPage_Created
 
Upvote 0

tariqyounis

Member
Licensed User
Longtime User
I have updated the test project so when you go to page2 you will see a text box. Any thing you fill in this box, it should be the title of the menu in the main page. and it should stay there when you return from page 2 to the main page, it should not go to page one by itself
 

Attachments

  • Project.zip
    185 KB · Views: 201
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
why you dont use the "setTabText" function?
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
showMenu
End Sub
Sub B4XPage_Appear
    If ASTabMenu_horizontal.TabSize > 0 Then
    ASTabMenu_horizontal.setTabText(1,$"${Main.code}"$)
    End If
End Sub
 

Attachments

  • AS Tab Menu Example.zip
    186.5 KB · Views: 218
Upvote 0

tariqyounis

Member
Licensed User
Longtime User
why you dont use the "setTabText" function?
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
showMenu
End Sub
Sub B4XPage_Appear
    If ASTabMenu_horizontal.TabSize > 0 Then
    ASTabMenu_horizontal.setTabText(1,$"${Main.code}"$)
    End If
End Sub
thank you for your prompt reply, but what about if instead of just changing the title, I would like to add one extra menu item based on the returned value of page2
 
Upvote 0
Top