Wish B4XPage Template : Request to include additional B4XPage Event Subs

Mashiane

Expert
Licensed User
Longtime User
Ola

With new learning curve into this sphere, I kindly request that the B4XPage template be beefed up a little.

How to reproduce?

Project > Add New Module > Class Module > B4XPage..

At the moment only 2 subs are added, Initialize and B4XPage_Created. The rest, dololo....

I was reading about B4XPages and the number of events is massively interesting.

B4XPages Events

  • B4XPage_Created - Called once when the page is created. This will happen before the page becomes visible or after a call to B4XPages.AddPageAndCreate.
  • B4XPage_Appear - Called whenever the page becomes visible.
  • B4XPage_Disappear - Called whenever a visible page disappear.
  • B4XPage_Background - Called when the app is moved to the background. This event will be raised in all pages that implement this sub, not just the top event. This is a good place to save anything that needs to be save as the process might be killed later. Note that in B4J it is raised when the last page is closed.
  • B4XPage_Foreground - Called when the app moved to the foreground.
  • B4XPage_Resize (B4J / B4i) - Called when the page is resized.
  • B4XPage_CloseRequest (B4J / B4A) - In B4A it is called when the user clicks on the back key or on the up indicator. In B4J it is called when the user clicks on the close button. See post #4 for more information.
  • B4XPage_MenuClick - Called when a menu item item or BarButton in B4i is clicked. See post #5 for more information.
  • B4XPage_KeyboardStateChanged (B4i) - Called when the keyboard state changes.
  • B4XPage_IconifiedChanged (B4J) - Called when a page is minimized or restored.
  • B4XPage_PermissionResult (B4A) - Raised after a call to rp.CheckAndRequest.[/code]

The template can be enhanced to include these events, even if they are commented out. This helps newbies like us with the learning curve. For example, the additional event could be

B4X:
'called whenever the page becomes visible:
Sub B4XPage_Appear

'End Sub

For example, I am using this method to change the title of the page. Yes one can set the title on BX4Page_Created, with a lot of pages and dynamic titles, that is handier. #NewbieThoughts.

Thank you...
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The template tells you very clearly how to see all the events:
B4X:
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

And here are the events:
1607494542381.png
 

JesseW

Active Member
Licensed User
Longtime User
The template tells you very clearly how to see all the events:
B4X:
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

And here are the events:
View attachment 104154
Erel, my apologies for the late question, but this is where I believe it belongs. the Resize event isn't in the list. And that's the one you said to use to get the width and height of a b4xpage. I found its declaration in another example, but only b4i code was inside. does this work with b4a? does this event fire when the page is created so the code can manipulate views inside the visible range? thx!
 
Top