Link to home
Start Free TrialLog in
Avatar of Mike Littlewood
Mike LittlewoodFlag for United Kingdom of Great Britain and Northern Ireland

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.
Avatar of saravananvg
saravananvg
Flag of India image

Hello Sir,

 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.
ASKER CERTIFIED SOLUTION
Avatar of saravananvg
saravananvg
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Littlewood

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;
saravananvg's method worked for what I needed.