>oMainForm = NEWOBJECT("testform","text_form1.prg") >oMainForm.visible=.t. >READ EVENTS >define class testform as form > oObject = .NULL. > PROCEDURE Remove_Form > lparameter olForm > thisform.oObject = .NULL. > ENDPROC > ADD OBJECT command1 as commandbutton with ; > left = 60, top = 20, height = 40, width = 200,; > caption = "Current Memory" > PROCEDURE command1.click > messagebox(sys(1016)) > ENDPROC > ADD OBJECT command2 as commandbutton with ; > left = 60, top = 60, height = 40, width = 200,; > caption ="Run Test #1 (no custom classes)" > PROCEDURE command2.click > messagebox(sys(1016)) && Memory used before creation > thisform.oObject = newobject("form") > thisform.oObject.visible = .t. > messagebox(sys(1016)) && Memory used after creation > thisform.oObject.release() > messagebox(sys(1016)) && Memory used after release > ENDPROC > ADD OBJECT command3 as commandbutton with ; > left = 60, top = 100, height = 40, width = 200,; > caption ="Run Test #2 (using a custom form)" > PROCEDURE command3.click > messagebox(sys(1016)) && Memory used before creation > thisform.oObject = newobject("testform2","text_form1.prg") > thisform.oObject.visible = .t. > messagebox(sys(1016)) && Memory used after creation > thisform.oObject.release() > messagebox(sys(1016)) && Memory used after release > ENDPROC > ADD OBJECT command4 as commandbutton with ; > left = 60, top = 140, height = 40, width = 200,; > caption ="Run Test #3 (using a custom form)" > PROCEDURE command4.click > messagebox(sys(1016)) && Memory used before creation > thisform.oObject = newobject("testform3","text_form1.prg",NULL,thisform) > thisform.oObject.visible = .t. > messagebox(sys(1016)) && Memory used after creation > ENDPROC > PROCEDURE Destroy > CLEAR EVENTS > ENDPROC >enddefine >define class test_txtbox as textbox > height = 15 >enddefine >define class testform2 as form > ADD OBJECT textbox1 as test_txtbox with ; > left = 100, top = 100 >enddefine >define class testform3 as form > ReturnTo = .NULL. > PROCEDURE INIT > lparameter oForm > thisform.ReturnTo = oForm > ENDPROC > ADD OBJECT command1 as commandbutton with ; > left = 100, top = 100 > PROCEDURE command1.click > thisform.ReturnTo.remove_form(thisform) > thisform.ReturnTo = .NULL. > thisform.release() > ENDPROC >enddefine