Update
I tested the above with a simplified, no-B4xPages app and it doesn't show the same behaviour.
Working on my original B4xPages code I found a couple of surprising conditions:
1. B4xPage_Foreground gets called before B4xPage_Created (talking about MainPage)
2. The couple "Page1.Initialize - B4XPages.AddPageAndCreate(..)" is not "atomic" in the sense that if you have a few pages to init, you see the creation of all of them, then, eventually, some code (I tried with a simple Log instruction that follows the block of initializations) and, finally, by as many Resize actions as your initialized pages.
In my case I had the hiding of the splash screen just following the block, so the result was that the underlying panel came to view before all the init was done.
I changed my code so now I have an InitPages ResumableSub that's called by a wait-for in the Created event prior to hide the splash screen (and I could eliminate the sleep instruction mentioned in my post above).
Since this is a wish, maybe a better one could be:
- add a core/global AcceptInput(<code> as int, action as boolean)
where <code> would use constants like Mouse, Keyboard ANDed together to specify on which input channel apply the action
The function, when action is False, will cause an internal consumption of any event of the given type until a subsequent call to the same function with action=True.
Again, I don't know whether this is feasible.