Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //child form
- type
- TMyRec = packed record
- s1: String;
- s2: String;
- end;
- TForm2 = class(TForm)
- <skiped>
- private
- FMyRec: TMyRec;
- procedure SetMyRec(AValue: TMyRec);
- public
- property MyRec: TMyRec read FMyRec write SetMyRec;
- end;
- procedure TForm2.SetMyRec(AValue: TMyRec);
- begin
- if (FMyRec.s1 <> AValue.s1) then FMyRec.s1:= AValue.s1;
- if (FMyRec.s2 <> AValue.s2) then FMyRec.s2:= AValue.s2;
- end;
- procedure TForm2.FormCreate(Sender: TObject);
- begin
- MyRec:= Default(TMyRec);
- end;
- //parent form
- procedure TForm1.Button1Click(Sender: TObject);
- var
- tf: TForm2;
- begin
- tf:= TForm2.Create(Self);
- try
- tf.MyRec.s1:= 'aaaaaa';
- tf.MyRec.s2:= 'ssssss';
- tf.ShowModal;
- finally
- FreeAndNil(tf);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement