unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
// abys wiedzial po co jest button
procedure TForm1.FormCreate(Sender: TObject);
begin
Button1.Caption := 'Ustawienia';
end;
// button na formie [1] wywoluje forme [2] w stanie modalnym
procedure TForm1.Button1Click(Sender: TObject);
begin
if Form2.ShowModal() = mrOk then // jezeli nacisnieto na formie [2] ok to
begin
Edit1.Text := Form2.Edit1.Text; // wykonaj przypisanie editow
end;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm2 = class(TForm)
Edit1: TEdit;
BitBtn1: TBitBtn;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
// abys wiedzial jaka akcja przypisana jest do buttona
BitBtn1.ModalResult := mrOk;
end;
end.