Mike Littlewood
asked on
Minimise parent form when minimising a showmodal child
I guess the title says it all, but how do you minimise the main parent form when minimising a child form that is showmodal.
Also I guess maximising the child form again.
Also I guess maximising the child form again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I dont think I explained myself correctly, this is not an MDI application, just 2 forms
ie
procedure TForm1.Button1Click(Sender : TObject);
begin
try
Form2 := TForm2.Create;
Form2.ShowModal
finally
FreeAndNil(Form2)
end;
end;
ie
procedure TForm1.Button1Click(Sender
begin
try
Form2 := TForm2.Create;
Form2.ShowModal
finally
FreeAndNil(Form2)
end;
end;
ASKER
saravananvg's method worked for what I needed.
First of all you cannot show a child form as modal as it gives an error saying "Cannot Hide an MDI child form'. Because we cannot make a visible window Modal. Hence both contradict. If you wish to perform the same operation using normal forms then give the following instructions.
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if Action = caMinimize then
Form1.WindowState := wsMinimized;
end;
with regards,
padmaja.