good afternoon, I have started to use b4xpages currently I have 2 pages.
with the following code
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Page1")
Page2.Initialize
B4XPages.AddPage("Page2", Page2)
'Here i will call sub to show page2
loadMysecondpage
End sub
public Sub loadMysecondpage
B4XPages.ShowPageAndRemovePreviousPages("Page2")
End sub
but every time I try to show Page2 it doesn't show up unless I press the back button on the phone.
why I am doing wrong?
Hi: I'm starting to play with B4XPages, just adapting this example It has a login page an then 2 others. What I want to do is to save the logged user (i.e. in KVS) and, from then on, once you start the app check if the user is already logged, then go to the next page instead of B4XMainPage...
I have installed the latest b4x version and now I have b4xpages 1.08
but I still have the same behavior I had to press the back button in order to show page2
I figure it out i should have called loadMysecondpage
in the event B4XPage_Appear , but I really don't understand why was that needed what is the difference between calling it in Create event or in Appear event ..
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Page1")
Page2.Initialize
B4XPages.AddPage("Page2", Page2)
'Here i will call sub to show page2
CallSubDelayed(Me, "loadMysecondpage")
End sub
Something like this would have also worked. What do you think @LucaMs the only 'Mario'
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Page1")
P2.Initialize
B4XPages.AddPage("Page2", P2)
Sleep(0)
B4XPages.ShowPageAndRemovePreviousPages("Page2")
End Sub
here is a sample that should demonstrate that behavior. The second-page won't show up in that example if it's called in
B4XPage_Created event unless you press the back button on the phone
You are doing something unexpected. If you want to show the second page without showing the first page then add page2 in the Initialize sub. No need to call Show at all.