B4J Question SetOwner(MainForm) open over the form

Discussion in 'B4J Questions' started by sigster, Apr 20, 2015.

  1. sigster

    sigster Active Member Licensed User

    this is if you use two LCD screen
    When you use SetOwner the second form open over Mainform but if you move mainform to another LCD
    the addnew open in Default LCD not over the Mainform

    how can I fix this :)

    addnew.SetOwner(MainForm)

    Regards
    Sigster
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The owner property doesn't affect the position.

    You can use this code to show the child form in the center:
    Code:
    Sub MainForm_MouseClicked (EventData As MouseEvent)
       
    Dim frm2 As Form
       frm2.Initialize(
    "frm2"500500)
       frm2.Show
       SetFormInCenter(MainForm, frm2)
    End Sub

    Sub SetFormInCenter(Parent As FormForm As Form)
       
    Form.WindowTop = Parent.WindowTop + (Parent.WindowHeight - Form.WindowHeight) / 2
       
    Form.WindowLeft = Parent.WindowLeft + (Parent.WindowWidth - Form.WindowWidth) / 2
    End Sub
     
Loading...
  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