The following, often used, snippet is required to create a program that uses a form created in the form editor. The default name of the form is frm1.
LoadForm frm1 Hidden
Do
Sleep
Until Me Is Nothing
Sub frm1_Load
/* Todo: initialise controls */
frm1.Show
EndSub
Additionally, code for the event Sub frm1_Load is attached to perform initialization of the controls the form contains. To prevent flicker the form is loaded invisible and displayed after the initializations.
Sub Gfa_Init
Gfa_AddMenu "Load Form Snippet", Gfa_Menu_CreateBasic
End Sub
Sub Gfa_Menu_CreateBasic(i%)
Local a$
a = InputBox("Enter name of form", "", "frm1")
If Len(a)
' Insert main program
Gfa_Insert #10#10
Gfa_Insert "LoadForm " & a & " Hidden"#10#10
Gfa_Insert "Do" #10 "Sleep" #10 "Until Me Is Nothing"
Gfa_Insert #10#10
' Insert _Load event sub
Gfa_Line = Gfa_LineCnt
Gfa_Insert #10#10 "Sub " & a & "_Load" #10
Gfa_Insert "/* Todo: initialize controls " + "#10#10"
Gfa_Insert a & ".Show"#10#10
Gfa_Insert "End Sub"#10
EndIf
End Sub
{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}