gtas
asked on
Do I need to free memory from dynamically created form?
Hi,
I have a Delphi 2 app using MDI. The application only allows ONE copy of each window to be in existance. Code fragment is....
////////////////////////// ////////// ////////// /////
procedure TMainForm.CommissionPlanMe nuClick(Se nder: TObject);
var
Child: TCommPlanF;
N : Integer;
begin
{ create a new MDI child window }
Child := nil;
with Application.MainForm do
for N := 0 to MDIChildCount - 1 do
if MDIChildren[N] is TCommPlanF then
Child := MDIChildren[N] as TCommPlanF;
if Child = nil then
Child := TCommPlanF.Create(Applicat ion)
else {_ NOT if Child = nil then _}
with Child do
begin
if WindowState = wsMinimized then WindowState := wsNormal;
BringToFront;
end; {_ with Child do _}
end; {_ procedure TMainForm.CommissionPlanMe nuClick(Se nder: TObject); _}
////////////////////////// ////////// ////////// /////////
This dynamically creates the window. The question becomes... Do I need to do something to free the memory after the window is closed or is this done for me automatically? If I need to free the memory, do I use the TFORM.RELEASE method?
Thanks
GTAS
I have a Delphi 2 app using MDI. The application only allows ONE copy of each window to be in existance. Code fragment is....
//////////////////////////
procedure TMainForm.CommissionPlanMe
var
Child: TCommPlanF;
N : Integer;
begin
{ create a new MDI child window }
Child := nil;
with Application.MainForm do
for N := 0 to MDIChildCount - 1 do
if MDIChildren[N] is TCommPlanF then
Child := MDIChildren[N] as TCommPlanF;
if Child = nil then
Child := TCommPlanF.Create(Applicat
else {_ NOT if Child = nil then _}
with Child do
begin
if WindowState = wsMinimized then WindowState := wsNormal;
BringToFront;
end; {_ with Child do _}
end; {_ procedure TMainForm.CommissionPlanMe
//////////////////////////
This dynamically creates the window. The question becomes... Do I need to do something to free the memory after the window is closed or is this done for me automatically? If I need to free the memory, do I use the TFORM.RELEASE method?
Thanks
GTAS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
MyForm.Free;