B4J Question B4J Form related Subs

ThRuST

Well-Known Member
Licensed User
Longtime User
Hello World :)

As I am building a B4J database module for my project Athena I want to know all the Form related Subs for B4J.
You will be able to use it as the B4J module will be freely available and a beta version will be released in about a month from today.

Example
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
End Sub

Documents manager
upload_2019-1-21_16-42-49-png.76533
 
Last edited:

Roycefer

Well-Known Member
Licensed User
Longtime User
Type "MainForm." in the IDE and the autocomplete will give you a list of all the Subs for the Form object. Alternatively, you can find the XML file for the jFX library (it will be in your internal libraries folder) and peruse that.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Thanks I will try that. I assume typing Mainform. will be enough and equal to opening the XML file.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
@Roycefer That is also very useful, but I was thinking specifically on Subs like this

B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    MainForm.close   
End Sub

B4X:
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

There might be more?
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
Those aren't Form-related subs. Those are event subs for the application, itself. You'll have those same event subs in a non-ui application (albeit without AppStart's first argument).
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
You can view the Form-related event subs by typing "Sub " and then Tab (Sub, space, then Tab) and then selecting "Form" from the list.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
That's nice I didn't know about this feature. This will come in very handy.

Thanks :)
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Let's shed some light upon these event subs

B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
End Sub

Sub MainForm_Closed
    
End Sub

Sub MainForm_CloseRequest (EventData As Event)
    
End Sub

Sub MainForm_FocusChanged (HasFocus As Boolean)
    
End Sub

Sub MainForm_IconifiedChanged (Iconified As Boolean)
    
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
AppStart = Runs directly the application is started
_Closed = User closes the form
_FocusChanged = The form loses focus
...
 
Upvote 0
Top