B4J Question how to create multiple window app

Mikelgiles

Active Member
Licensed User
Longtime User
I have two forms designed in the designer but when I run the code below Detail.Show does work and then Master.show works but the Detail window goes away. Can I only have one window open from AppStart?
I took a look at the example but looking didn't really help. I am pretty new to B4J. I have been licensed for B4A for almost a year but have not really used it because I decided I needed the windows app working before doing the B4A app. Any help would be appreciated. I have included the entire app if needed.


Sub Process_Globals
Private fx As JFX
Private Detail As Form
Private Master As Form
Private tvDetail As TableView
Private tvMaster As TableView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
Detail = Form1
Detail.RootPane.LoadLayout("Detail") 'Load the layout file.
Detail.Show
Master = Form1
Master.RootPane.LoadLayout("master") 'Load the layout file.
Master.Show
End Sub
 

Attachments

  • CashFlow.zip
    2.7 KB · Views: 288

Daestrum

Expert
Licensed User
Longtime User
Set your mainform to Form1
all the others use mynewform.Initialize("newform",300,300)
eg,
B4X:
sub AppStart(...)
MainForm = Form1
MainForm.RootPane.LoadLayout(...)
MainForm.show
...
newForm.Initialize("newForm",300,300)
newForm.RootPane.LoadLayout(...)
newForm.show
...

Also, when you post code use the tags like below, but without the . in them, as it will get formatted and be easier to read for others.
[.code]
your posted code between these tags.
[./code]
 
Last edited:
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
Set your mainform to Form1
all the others use mynewform.Initialize("newform",300,300)
eg,
B4X:
sub AppStart(...)
MainForm = Form1
MainForm.RootPane.LoadLayout(...)
MainForm.show
...
newForm.Initialize("newForm",300,300)
newForm.RootPane.LoadLayout(...)
newForm.show
...

Also, when you post code use the tags like below, but without the . in them, as it will get formatted and be easier to read for others.
[.code]
your posted code between these tags.
[./code]

Thanks very much. It works like a charm once it is done correctly! And I will use the tags next time.
 
Upvote 0
Top