B4J Question Anyway to trap program exit ?

Gary Miyakawa

Active Member
Licensed User
Longtime User
Is there anyway to trap/catch the close/exit of a b4j application ? I'd like to clean a few things up before terminating.

Thanks,

Gary M
 

stevel05

Expert
Licensed User
Longtime User
You can use a callback on the MainForm:

B4X:
Sub MainForm_CloseRequest (EventData As Event)
 
End Sub

I'm not sure if there are any limitations as to what you can do in there, as there are in B4a Activity_pause, but i don't think so.
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
You can use a callback on the MainForm:

B4X:
Sub MainForm_CloseRequest (EventData As Event)
 
End Sub

I'm not sure if there are any limitations as to what you can do in there, as there are in B4a Activity_pause, but i don't think so.


Thank you so much... BTW, how would I have found this sort of thing ? are the callbacks for mainform documented somewhere (or is that a Java thing) ??
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It'll be documented somewhere in the JavaFX docs on the oracle web site, but it's probably easier to ask on the forum. I think I originally saw it on here somewhere.

If you're curious about whats available for an Object in B4j, in the IDE you can type Sub then the space bar, then Tab and you'll get a list of Objects, select one and you'll get a list of methods that are exposed for that Object. Same for B4a.
 
Upvote 0

myriaddev

Active Member
Licensed User
Longtime User
How do I prevent an exit in B4J like in B4A until user is asked if to leave program?
Thanks, Jerry

Answer:
Sub MainForm_CloseRequest (EventData As Event)
EventData.Consume
End Sub
 
Upvote 0
Top