i am using this Sub from @LucaMs
I want to center my MainForm (B4XPages), but this doesnt work:
What am i missing ?
B4X:
'Center the form, on the parent form if it is passed (you can pass Null)
'otherwise on the Desktop.
Private Sub CenterForm(Frm As Form, Parent As Form)
Dim JFX1 As JFX
If Initialized(Parent) Then
Frm.WindowLeft = Parent.WindowLeft + (Parent.Width - Frm.Width) / 2
Frm.WindowTop = Parent.WindowTop + (Parent.Height - Frm.Height) / 2
Else
Dim PS As Screen = JFX1.PrimaryScreen
Frm.WindowLeft = (PS.MaxX - PS.MinX) / 2 - Frm.Width / 2
Frm.WindowTop = (PS.MaxY - PS.MinY) / 2 - Frm.Height / 2
End If
End Sub
I want to center my MainForm (B4XPages), but this doesnt work:
B4X:
CenterForm(Root,Null)
What am i missing ?
Last edited: