Tech Tip: Be sure to unload the form loaded for printing to restore the context of the current form
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: June 6, 2022
When calling the command FORM LOAD for printing, the context of the loaded form will stack on top of the current form that was opened with the command DIALOG, MODIFIY SELECTION, MODIFY RECORD, etc.
Consider the following code where the current form has its FORM object is defined. Any attempt to access to FORM object property after the execution of FORM LOAD will result in a runtime error.
FORM.name:="John" OPEN PRINTING JOB FORM LOAD("Form1") // This line will cause a runtime error because // the FORM object for "Form1" is null If(FORM.name="John") // Do something here End if FORM UNLOAD |
Once "Form1" is released by the command FORM UNLOAD, the context of the current form will be restored and the FORM object will be accessible again.