unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
function formerzeugen(fclass:TFormClass;
var nform):boolean;
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
formerzeugen(TForm2,form2);
end;
function TForm1.formerzeugen(fclass:TFormClass;
var nform):boolean;
Begin
application.CreateForm(fclass,nform);
(nform
as TForm).show
//geht nicht :[Fehler] Unit1.pas(39): Operator ist auf diesen Operandentyp nicht anwendbar
end;
end.
//////////////////////////////////////////////
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 =
class(TForm)
Label1: TLabel;
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
end.