Android Question B4XPages get parent page name

TheRealMatze

Active Member
Licensed User
Hi,
when i switch to a side with B4XPages.showpage("pagename") - is there a option inside b4xpages to get the name of the caller-page. I need it to start the correct update-scripts on the pages when i use one page in different locations. Currently i store it in a variable manually, but maybe there is a better way...

The situation:

Page A -> showPage -> Page B (need to know A is the caller) -> showpage -> Page C (need to know B is the caller)

but also

Page A -> showPage -> Page C (need to know A is the caller)

Regards
Matthias
 
Solution
Thank you LucaMs, thats the hint i need. I can use

B4X:
B4XPages.GetManager.mStackOfPageIds.AsList.Get(B4XPages.GetManager.mStackOfPageIds.AsList.Size-2)

to get the parent name. If it´s possible that the page is called with ShowPageAndRemovePreviousPages (not in my case) it can be handled by checking the size before.

Perfect!

TheRealMatze

Active Member
Licensed User
Maybe i understand it wrong - but for example in C i want to know if A or B was the caller.

The background is the following:

Page A is a list of all articles
Page B is a page where you define specifications for a article
Page C is a edit-page for a specific article

Normally you jump from B into C, but it is also possible to come from A to C. In C i want to know if my caller was A or B, because if A i want to update the CLV, if B i only need to update a info-box.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I'm not absolutely sure but I think you should "work" (use) on:

B4X:
B4XPages.GetManager.mStackOfPageIds
'and / or'
B4XPages.GetManager.mStackOfPageIds.AsList

(I assume the mStackOfPageIds contains "pages" in "LIFO" order, so the second in the stack should be the one who called the one currently on top).


P.S. Be careful if you use B4XPages.ShowPageAndRemovePreviousPages!
 
Last edited:
Upvote 0

TheRealMatze

Active Member
Licensed User
Thank you LucaMs, thats the hint i need. I can use

B4X:
B4XPages.GetManager.mStackOfPageIds.AsList.Get(B4XPages.GetManager.mStackOfPageIds.AsList.Size-2)

to get the parent name. If it´s possible that the page is called with ShowPageAndRemovePreviousPages (not in my case) it can be handled by checking the size before.

Perfect!
 
Upvote 0
Solution
Top