That's true and it is by design. In B4J all the pages remain visible until they are closed.
I'm sorry, I just don't understand. The description of this event states:
'B4XPage_Appear - Called whenever the page becomes visible.
I am closing that page (page 2). It is no longer visible on my screen. On my taskbar I had TWO Icons. 1 for 'MainPage' and one for 'Page 2' After I close 'Page 2' I have 1 Icon on my taskbar 'MainPage'. 'Page 2' is, to me, not visible. Under those circumstances it would seem to me that when I reopen 'Page 2' the B4XPage_Appear event would fire.
So if what is actually happening is ALL pages must be invisible and then the event fires but only for the page that is being made visible? If that is the case then it is inconsistent.
I open the program - MainPage is visible.
I open page 2 using
B4XPages.ShowPage
- B4XPage_Appear fires.
I close page 2 using
B4XPages.ShowPageAndRemovePreviousPages("MainPage")
MainPage B4XPage_Appear Fires clearing the password
I type in a new password and open page 2 again
B4XPage_Appear
does NOT fire.
I close page 2 using
B4XPages.ShowPageAndRemovePreviousPages("MainPage")
MainPage B4XPage_Appear does NOT fire.
Out of curiosity I then went to the code and changed btnLogin_Click
back to
B4XPages.ShowPageAndRemovePreviousPages("Page 2")
Without closing the program.
I then closed and reopened 'Page 2' several times and B4XPage_Appear never fired again.
So, it appears that if you open a page (at least from MainPage) using
ShowPage
rather than
ShowPageAndRemovePreviousPages
the
B4XPage_Appear
event will stop firing until the program is restarted.