cirollo Active Member Licensed User Longtime User Feb 22, 2015 #1 Hi to everyone! After using B4A and B4I I've decided to start using B4J for my desktop app. My question is: how can I open the same form more than one time (for example calling it from a menu)? Windows behaviour on my VFP app let me to open the same form (for example, invoices) more than one time and to minimize/maximize them or passing from one to another by clicking the form itself. is possible in B4j? regards, Ciro
Hi to everyone! After using B4A and B4I I've decided to start using B4J for my desktop app. My question is: how can I open the same form more than one time (for example calling it from a menu)? Windows behaviour on my VFP app let me to open the same form (for example, invoices) more than one time and to minimize/maximize them or passing from one to another by clicking the form itself. is possible in B4j? regards, Ciro
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2015 #2 cirollo said: is possible in B4j? Click to expand... Yes. Implement the form in a class and then you can create as many instances of this class as you need. Upvote 0
cirollo said: is possible in B4j? Click to expand... Yes. Implement the form in a class and then you can create as many instances of this class as you need.
cirollo Active Member Licensed User Longtime User Feb 22, 2015 #3 Erel said: Yes. Implement the form in a class and then you can create as many instances of this class as you need. Click to expand... ok, and please Erel....where I can find an example? thanks Upvote 0
Erel said: Yes. Implement the form in a class and then you can create as many instances of this class as you need. Click to expand... ok, and please Erel....where I can find an example? thanks
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2015 #4 Create a class named MyForm with this code: Code: Copy Sub Class_Globals Private fx As JFX Private form1 As Form End Sub Public Sub Initialize form1.Initialize("form1", 500, 500) form1.Title = "form1" End Sub Public Sub Show form1.Show End Sub In your main module put this code: Code: Copy Sub Process_Globals Private fx As JFX Private MainForm As Form End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.Show For i = 1 To 5 Dim mf As MyForm mf.Initialize mf.Show Next End Sub Run it and you will see one main form and 5 MyForms. Upvote 0
Create a class named MyForm with this code: Code: Copy Sub Class_Globals Private fx As JFX Private form1 As Form End Sub Public Sub Initialize form1.Initialize("form1", 500, 500) form1.Title = "form1" End Sub Public Sub Show form1.Show End Sub In your main module put this code: Code: Copy Sub Process_Globals Private fx As JFX Private MainForm As Form End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.Show For i = 1 To 5 Dim mf As MyForm mf.Initialize mf.Show Next End Sub Run it and you will see one main form and 5 MyForms.