Thema: Delphi Konzeptfrage FormCreate

Einzelnen Beitrag anzeigen

Zoot

Registriert seit: 30. Jan 2006
Ort: Hessen
113 Beiträge
 
Delphi 11 Alexandria
 
#9

Re: Konzeptfrage FormCreate

  Alt 12. Mai 2009, 10:25
So sollte es gehen:

Zitat von WIng2005:
Delphi-Quellcode:
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 : Tform):boolean;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation
uses unit2;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  formerzeugen(TForm2,TForm(form2));
end;

function TForm1.formerzeugen(fclass:TFormClass;var nform:Tform):boolean;
Begin
    application.CreateForm(fclass,nform);
    nform.show
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.
  Mit Zitat antworten Zitat