Maybe this will help you understand
Thanks, this has been useful for figuring out how to programmatically add controls to a form.
I am still trying to figure out a few things:
1.
Where should a form's code reside? In VB6/VB.NET code is "behind" forms. (You create forms and then attach code to them). However, with B4J it seems forms are created (or layout loaded) with code? (i.e. Code runs first, forms created or managed as a result?)
2. What is the best practice for organizing form code and modules? Do you
dump all form code in main or
create code modules and manage each form from a different module?
3. In the code (from Daestrum's example) below, how come the app doesn't end when MainForm.Close? Does the app remain open because there is another form (loginForm) open before MainForm.Close?
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("splash") 'Load the layout file.
MainForm.Show
Sleep(2000)
b.Initialize("login")
b.Text = "Press to login"
loginForm.Initialize("login",200,200)
loginForm.RootPane.AddNode(b,50,100,100,20)
loginForm.show
MainForm.close
4. In the above code, why do both the event handler for b.Initialize("login") and loginForm.Initialize("login",200,200) have the
same name? Wouldn't you want different names to avoid confusion? (especially if both objects have same possible events) What would happen if both the button and the form had same named events?
Sorry for all the questions but B4J/JavaFX is a little different to what I have experience with and am trying to understand.