Bug? B4XPages - GetPage crashes if pageid does not exists

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I am not sure if this is a Bug or Intended?

I have some pages that are only created based on options selected.

if you do a B4XPages.GetPage("Nothing") and Nothing page id does not exists B4XPages crashes

B4X:
Error: page id not found: Nothing
Ids: (ArrayList) [mainpage, pplaying, pplayqueue, pplayfrom, pdatabaselist, psettings, pscreensaver]

Seems like returning a Null Page would be better or some type of command like B4XPages.DoesPageExist("Nothing")

BobVal
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the designed behavior.

You are expected to add all pages once when the program starts. The pages are "lazy loaded", which means that you don't need to worry about performance. B4XPage_Created will only be called when the page is first shown (unless you add pages with the sometimes useful AddPageAndCreate method).
 
Top