Hi Guys, I am trying to write a program that pops up an entry form as a child of the main window. If you can view my code this would be good and advise.
I have viewed a lot of the threads on this and to be honest it is very frustrating when suggestions are made without sample code and the person works it out and just types 'SOLVED'. I would like this post to finish with myself uploading the working code with an explanation and completed code example.
Also doing it this way I do not contain the code for the Popup within the MODULE. So help on this would be good. Also I wish to pass a single variable when calling the popup.
Thanks In advance.
Phil
I have viewed a lot of the threads on this and to be honest it is very frustrating when suggestions are made without sample code and the person works it out and just types 'SOLVED'. I would like this post to finish with myself uploading the working code with an explanation and completed code example.
Also doing it this way I do not contain the code for the Popup within the MODULE. So help on this would be good. Also I wish to pass a single variable when calling the popup.
Thanks In advance.
Phil
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 400
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private SiteEdit As Form
Private MenuClose As MenuItem
Private edit_site As MenuItem
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("simFOLD_MainScreen") 'Load the layout file.
MainForm.Show
CenterFormOnScreen(MainForm)
End Sub
Sub CenterFormOnScreen(Frm As Form)
'Centers a form on the primary screen
Dim ps As Screen = fx.PrimaryScreen
Frm.WindowTop = (ps.MaxY - ps.MinY) / 2 - Frm.Height / 2
Frm.WindowLeft = (ps.MaxX - ps.MinX) / 2 - Frm.Width / 2
End Sub
Sub MenuClose_Action
MainForm.Close
End Sub
Public Sub SiteInputStart
SiteEdit.Initialize("SiteEdit", -1, -1)
SiteEdit.RootPane.LoadLayout("simFOLD_SiteInput") 'Load the layout file.
SiteEdit.Show
End Sub
Sub edit_site_Action
SiteInputStart
End Sub