unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMainForm = class(TForm)
Button1: TButton;
Button2: TButton;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
// FText: String;
{ Private declarations }
// function GetText:String;
// procedure SetText(const Value:String);
public
{ Public declarations }
// property Text:String read FText write SetText;
function GetText:String;
procedure SetText(const Value:String);
end;
var
MainForm: TMainForm;
implementation
uses Unit1, Unit2;
{$R *.dfm}
procedure TMainForm.Button1Click(Sender: TObject);
begin
form1.show;
end;
procedure TMainForm.Button2Click(Sender: TObject);
begin
form2.show;
end;
function TMainForm.GetText: String;
begin
Result:=Edit2.Text;
end;
procedure TMainForm.SetText(const Value: String);
begin
Edit2.Text:=Value;
end;
end.
{
private
function GetText:String;
procedure SetText(const Value:String);
public
property Text:String;read GetText write SetText;
function TformDialog.GetText:String;
begin
Result:=Edit1.Text;
end;
procedure TformDialog.SetText(const Value:String);
begin
Edit1.Text;=Value;
end;
###################3
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm2 = class(TForm)
procedure FormDblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses MainFrm;
{$R *.dfm}
procedure TForm2.FormDblClick(Sender: TObject);
begin
showmessage(MainForm.GetText );
end;
end.
¥#######################
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses MainFrm;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(MainForm.GetText );
end;
end.