makis_best Well-Known Member Licensed User Longtime User Dec 6, 2020 #1 Hi If I have load in my project 5 pages in my stack and i want to disappear the third page. How I can do it? Thank you.
Hi If I have load in my project 5 pages in my stack and i want to disappear the third page. How I can do it? Thank you.
LucaMs Expert Licensed User Longtime User Dec 6, 2020 #2 Declare as public your pages in B4XMainPage - Class_Globals, so you can write something like: B4X: Copy B4XPages.ClosePage(B4XPages.MainPage.MyThirdPage) Upvote 0
Declare as public your pages in B4XMainPage - Class_Globals, so you can write something like: B4X: Copy B4XPages.ClosePage(B4XPages.MainPage.MyThirdPage)
M Mahares Expert Licensed User Longtime User Dec 6, 2020 #3 LucaMs said: Declare as public your pages in B4XMainPage Click to expand... Hi Luca: I think you can do either one of these methods below without declaring the page object as public. I am checking with you because you have become a powerhouse to be reckoned with in B4XPages. Code: Copy B4XPages.ClosePage(B4XPages.MainPage.MyThirdPage) or: Code: Copy B4XPages.ClosePage(MyThirdPage) Knowing you get by with little sleep, you do not need to rush to answer. This can wait till tomorrow. Upvote 0
LucaMs said: Declare as public your pages in B4XMainPage Click to expand... Hi Luca: I think you can do either one of these methods below without declaring the page object as public. I am checking with you because you have become a powerhouse to be reckoned with in B4XPages. Code: Copy B4XPages.ClosePage(B4XPages.MainPage.MyThirdPage) or: Code: Copy B4XPages.ClosePage(MyThirdPage) Knowing you get by with little sleep, you do not need to rush to answer. This can wait till tomorrow.
LucaMs Expert Licensed User Longtime User Dec 6, 2020 #4 Of course you can close that page like that: Mahares said: B4XPages.ClosePage(MyThirdPage) Click to expand... but from within the B4XMainPage only. By declaring the pages public, as mentioned previously, you can manage them (even close them, as in this case) from within any other page that is not the B4XMainPage. They, the B4XPages, are simply objects like any other; if in a module they are declared public, they will be accessible from anywhere in the project. Last edited: Dec 6, 2020 Upvote 0
Of course you can close that page like that: Mahares said: B4XPages.ClosePage(MyThirdPage) Click to expand... but from within the B4XMainPage only. By declaring the pages public, as mentioned previously, you can manage them (even close them, as in this case) from within any other page that is not the B4XMainPage. They, the B4XPages, are simply objects like any other; if in a module they are declared public, they will be accessible from anywhere in the project.
M Mahares Expert Licensed User Longtime User Dec 6, 2020 #5 LucaMs said: but from within the B4XMainPage only. By declaring the pages public, a Click to expand... No. I was able to close one of my pages from B4XMainPage without being public. But it was initialized in B4XMainPage. Please try it Upvote 0
LucaMs said: but from within the B4XMainPage only. By declaring the pages public, a Click to expand... No. I was able to close one of my pages from B4XMainPage without being public. But it was initialized in B4XMainPage. Please try it
LucaMs Expert Licensed User Longtime User Dec 6, 2020 #6 Yes... Mahares said: from B4XMainPage Click to expand... not from another page. Example: I have the B4XMainPage and 3 other: Pag1, Pag2, Pag3. If I declare them Private in B4XMainPage, I cannot write, within Pag2: B4X: Copy B4XPages.ClosePage(B4XPages.MainPage.Pag1) of course, because Pag1 is not public. Note: writing simply "Dim" in Class_Globals it is implicitly Public, but I never write "Dim" there, only inside routines. Last edited: Dec 6, 2020 Upvote 0
Yes... Mahares said: from B4XMainPage Click to expand... not from another page. Example: I have the B4XMainPage and 3 other: Pag1, Pag2, Pag3. If I declare them Private in B4XMainPage, I cannot write, within Pag2: B4X: Copy B4XPages.ClosePage(B4XPages.MainPage.Pag1) of course, because Pag1 is not public. Note: writing simply "Dim" in Class_Globals it is implicitly Public, but I never write "Dim" there, only inside routines.
Erel B4X founder Staff member Licensed User Longtime User Dec 7, 2020 #7 As the pages instances are regular class instances, there are many ways to access the pages. The two most common ways are: - Declare them as public variables: Code: Copy B4XPages.ClosePage(B4XPages.MainPage.Pag1) - Use B4XPages.GetPage: Code: Copy B4XPages.ClosePage(B4XPages.GetPage("Page 3 id")) Upvote 0
As the pages instances are regular class instances, there are many ways to access the pages. The two most common ways are: - Declare them as public variables: Code: Copy B4XPages.ClosePage(B4XPages.MainPage.Pag1) - Use B4XPages.GetPage: Code: Copy B4XPages.ClosePage(B4XPages.GetPage("Page 3 id"))