TFormOnDestroy (Delphi)
Description
The following code explicitly allocates memory for a pointer in the OnCreate event of Form1, then releases the memory in the OnDestroy event. Assume that MyPtr is a Pointer type field of TForm1.
Code
procedure TForm1.FormCreate(Sender: TObject);
begin
New(MyPtr);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Dispose(MyPtr);
end;
Uses
- Vcl.Forms.TCustomForm.OnDestroy ( fr | de | ja )
- System.New ( fr | de | ja )
- System.Dispose ( fr | de | ja )