MikeGreen99 wrote: Fri Dec 05, 2025 10:15 pmIf I add:
OpenTestForm01()
to the form "FormTest01.pbf", I will lose this line as the Form Code is continually being regenerated.
We shouldn't
add anything to the form code files. They are automatically-generated files and will continue to regenerate as the form is edited, purging all foreign code in the process. All program logic should be handled in separate code files.
A standard form code file should look something like this:
Code: Select all
;
; This code is automatically generated by the Form Designer.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures need to be put in another source file.
;
Global Window_0
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_SystemMenu)
EndProcedure
To open the window, you should be calling
OpenWindow_0().
However,
if you had changed the window variable in the form properties, by renaming it from the default
Window_0, to say,
MyWindow, the procedure name would also change - to
OpenMyWindow().
Check the form code file and call the named procedure accordingly. Then,
run the following snippet from another code file which has been saved in the same folder as the form file:
Code: Select all
XIncludeFile "TestForm01.pbf"
OpenWindow_0() ; <--- call the correct procedure here
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend