tariqyounis Active Member Licensed User Longtime User Oct 21, 2020 #1 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. Code: Copy Sub ASTabMenu_horizontal_TabClick(index As Int) If index = 0 Then findUser Else B4XPages.ShowPage("mdlSignup") End If End Sub
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. Code: Copy Sub ASTabMenu_horizontal_TabClick(index As Int) If index = 0 Then findUser Else B4XPages.ShowPage("mdlSignup") End If End Sub
Alexander Stolte Expert Licensed User Longtime User Oct 21, 2020 #2 Try to recreate it in a project. I have not found any problems. Upvote 0
tariqyounis Active Member Licensed User Longtime User Oct 21, 2020 #3 Alexander Stolte said: Try to recreate it in a project. I have not found any problems. Click to expand... when you run the app, go to page2 then come back to the main page, you will find your self in page1 which is not right. Attachments Project.zip Project.zip 184.7 KB · Views: 516 Upvote 0
Alexander Stolte said: Try to recreate it in a project. I have not found any problems. Click to expand... when you run the app, go to page2 then come back to the main page, you will find your self in page1 which is not right.
Alexander Stolte Expert Licensed User Longtime User Oct 21, 2020 #4 tariqyounis said: you will find your self in page1 which is not right. Click to expand... 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. Upvote 0
tariqyounis said: you will find your self in page1 which is not right. Click to expand... 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.
tariqyounis Active Member Licensed User Longtime User Oct 22, 2020 #5 Alexander Stolte said: 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. Click to expand... 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
Alexander Stolte said: 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. Click to expand... 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
tariqyounis Active Member Licensed User Longtime User Oct 22, 2020 #6 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 Project.zip 185 KB · Views: 511 Upvote 0
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
Alexander Stolte Expert Licensed User Longtime User Oct 22, 2020 #7 why you dont use the "setTabText" function? B4X: Copy 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 AS Tab Menu Example.zip 186.5 KB · Views: 531 Upvote 0
why you dont use the "setTabText" function? B4X: Copy 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
tariqyounis Active Member Licensed User Longtime User Oct 22, 2020 #8 Alexander Stolte said: why you dont use the "setTabText" function? B4X: Copy 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 Click to expand... 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
Alexander Stolte said: why you dont use the "setTabText" function? B4X: Copy 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 Click to expand... 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
Alexander Stolte Expert Licensed User Longtime User Oct 22, 2020 #9 tariqyounis said: I would like to add one extra menu item based on the returned value of page2 Click to expand... Then you can add a new tab or remove a specific tab and then add a new tab. B4X: Copy ASTabMenu_horizontal.RemoveAt(1) Upvote 0
tariqyounis said: I would like to add one extra menu item based on the returned value of page2 Click to expand... Then you can add a new tab or remove a specific tab and then add a new tab. B4X: Copy ASTabMenu_horizontal.RemoveAt(1)
tariqyounis Active Member Licensed User Longtime User Oct 22, 2020 #10 Alexander Stolte said: Then you can add a new tab or remove a specific tab and then add a new tab. B4X: Copy ASTabMenu_horizontal.RemoveAt(1) Click to expand... Thank you, I think this will do the trick. Upvote 0
Alexander Stolte said: Then you can add a new tab or remove a specific tab and then add a new tab. B4X: Copy ASTabMenu_horizontal.RemoveAt(1) Click to expand... Thank you, I think this will do the trick.