//==============================================================================
// if mark=0 then Tform.show else Tform.showmodal
//==============================================================================
procedure OpenChildForm(FormClass:TFormClass;Mark:Integer=0);
var
I: Integer;
Child: TForm;
begin
if Mark=0 then
begin
for I := 0 to Screen.FormCount - 1 do
if Screen.Forms[I].ClassType = FormClass then
begin
Child := Screen.Forms[I];
if Child.WindowState = wsMinimized then
ShowWindow(Child.Handle,SW_SHOWMAXIMIZED)
else
ShowWindow(Child.handle,SW_SHOWNA);
if (not Child.Visible) then Child.Visible := True;
Child.BringToFront;
Child.Setfocus;
Exit;
end;
Child := TForm(FormClass.NewInstance);
Child.Create(Application);
end else begin
Child:=TForm(FormClass.NewInstance);
Child.Create(nil).ShowModal;
Child.Free;
end;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//==============================================================================
// if mark=0 then Tform.show else Tform.showmodal
//==============================================================================
procedure OpenChildForm(FormClass:TFormClass;var Form:TForm;Mark:Integer=0);
begin
if Mark=0 then
begin
if not Assigned(form) then Application.CreateForm(FormClass,Form);
if Form.WindowState=wsminimized then Form.WindowState:=wsMaximized;
end else begin
form:=FormClass.Create(nil);
Form.ShowModal;
Form.Free;
end;
end;