B4J Question multiple istances of same form

Discussion in 'B4J Questions' started by cirollo, Feb 22, 2015.

  1. cirollo

    cirollo Active Member Licensed User

    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?


  2. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Implement the form in a class and then you can create as many instances of this class as you need.
  3. cirollo

    cirollo Active Member Licensed User

    ok, and please Erel....where I can find an example?

  4. Erel

    Erel Administrator Staff Member Licensed User

    Create a class named MyForm with this code:
    Sub Class_Globals
    Private fx As JFX
    Private form1 As Form
    End Sub

    Public Sub Initialize
       form1.Title = 
    End Sub

    Public Sub Show
    End Sub
    In your main module put this code:
    Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
    For i = 1 To 5
    Dim mf As MyForm
    End Sub
    Run it and you will see one main form and 5 MyForms.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice