So dürfte eigentlich nichts dagegen sprechen:
Delphi-Quellcode:
function ShowModalForm(AClass: TFormClass): Integer;
begin
var lForm := TFormClass.Create(nil);
try
Result := lForm.ShowModal;
finally
lForm.Free;
end;
end;
procedure ShowForm(AClass: TFormClass);
begin
{Formular bereits erzeugt und sichtbar ?}
for var n := 0 to Application.ComponentCount - 1 do
begin
if Application.Components[n].ClassType = AClass then
begin
var lForm := Application.Components[n] as TFormClass;
if not lForm.Visible then
lForm.Show;
lForm.BringToFront;
Exit;
end;
end;
{erzeugen und anzeigen}
TFormClass.Create(Application).Show;
end;